from django.core.cache.backends.memcached import CacheClass as MemcachedCacheClass
from django.conf import settings
+from django.utils.encoding import smart_str
from cache_utils.utils import sanitize_memcached_key
# This prefix is appended to the group name to prevent cache key clashes.
_VERSION_PREFIX = getattr(settings, 'VERSION', "")
# MINT_DELAY is an upper bound on how long any value should take to
# be generated (in seconds)
key = "%s:%s-%s" % (group, key, hashkey)
+ def make_key(self, key, *args, **kwargs):
+ A hack to make backend work correctly with django 1.3.
+ Key prefixes and cache versions are now supported out of box but
+ this class uses its own settings and in order to provide
+ backward compatibility django's new features are not used.
def _get_hashkey(self, group):
""" This can be useful sometimes if you're doing a very large number
of operations and you want to avoid all of the extra cache hits.