mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-16 21:30:23 +00:00
Use a compat method to wrap the new way of retrieving the cache engine
This commit is contained in:
parent
673b95b4c4
commit
0a0708d2d6
2 changed files with 11 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue