diff --git a/imagekit/cachefiles/backends.py b/imagekit/cachefiles/backends.py index 5e7025a..e615f2e 100644 --- a/imagekit/cachefiles/backends.py +++ b/imagekit/cachefiles/backends.py @@ -1,7 +1,6 @@ -from ..utils import get_singleton, sanitize_cache_key +from ..utils import get_singleton, get_cache, sanitize_cache_key import warnings from copy import copy -from django.core.cache import get_cache from django.core.exceptions import ImproperlyConfigured diff --git a/imagekit/utils.py b/imagekit/utils.py index 20ecda6..d768f57 100644 --- a/imagekit/utils.py +++ b/imagekit/utils.py @@ -151,6 +151,16 @@ def call_strategy_method(file, method_name): fn(file) +def get_cache(backend, **kwargs): + try: + from django.core.cache import caches + except ImportError: + from django.core.cache import get_cache + return get_cache(backend, **kwargs) + + return caches[backend] + + def sanitize_cache_key(key): if settings.IMAGEKIT_USE_MEMCACHED_SAFE_CACHE_KEY: # Memcached keys can't contain whitespace or control characters.