diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py
index 7d6b5b3..1de7dae 100644
a
|
b
|
class CacheClass(BaseCache):
|
40 | 40 | return timeout |
41 | 41 | |
42 | 42 | def add(self, key, value, timeout=0): |
43 | | if isinstance(value, unicode): |
44 | | value = value.encode('utf-8') |
45 | 43 | return self._cache.add(smart_str(key), value, self._get_memcache_timeout(timeout)) |
46 | 44 | |
47 | 45 | def get(self, key, default=None): |
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py
index 109374c..ec2534a 100644
a
|
b
|
class BaseCacheTests(object):
|
295 | 295 | self.cache.set(key, value) |
296 | 296 | self.assertEqual(self.cache.get(key), value) |
297 | 297 | |
| 298 | for (key, value) in stuff.items(): |
| 299 | self.cache.delete(key) |
| 300 | self.cache.add(key, value) |
| 301 | self.assertEqual(self.cache.get(key), value) |
| 302 | |
298 | 303 | def test_binary_string(self): |
299 | 304 | # Binary strings should be cachable |
300 | 305 | from zlib import compress, decompress |