Use a compat method to wrap the new way of retrieving the cache engine

This commit is contained in:
Pierre Dulac 2015-10-29 23:03:48 +01:00
parent 673b95b4c4
commit 0a0708d2d6
2 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -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.