mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Advanced deprecations in core.cache.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
2
django/core/cache/__init__.py
vendored
2
django/core/cache/__init__.py
vendored
@@ -80,7 +80,7 @@ if not settings.CACHES:
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"settings.CACHE_* is deprecated; use settings.CACHES instead.",
|
||||
PendingDeprecationWarning
|
||||
DeprecationWarning
|
||||
)
|
||||
else:
|
||||
# The default cache setting is put here so that we
|
||||
|
||||
24
django/core/cache/backends/memcached.py
vendored
24
django/core/cache/backends/memcached.py
vendored
@@ -126,24 +126,18 @@ class BaseMemcachedCache(BaseCache):
|
||||
def clear(self):
|
||||
self._cache.flush_all()
|
||||
|
||||
# For backwards compatibility -- the default cache class tries a
|
||||
# cascading lookup of cmemcache, then memcache.
|
||||
class CacheClass(BaseMemcachedCache):
|
||||
def __init__(self, server, params):
|
||||
warnings.warn(
|
||||
"memcached.CacheClass has been split into memcached.MemcachedCache and memcached.PyLibMCCache. Please update your cache backend setting.",
|
||||
PendingDeprecationWarning
|
||||
)
|
||||
try:
|
||||
import cmemcache as memcache
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"Support for the 'cmemcache' library has been deprecated. Please use python-memcached or pyblimc instead.",
|
||||
DeprecationWarning
|
||||
)
|
||||
except ImportError:
|
||||
try:
|
||||
import memcache
|
||||
except:
|
||||
raise InvalidCacheBackendError(
|
||||
"Memcached cache backend requires either the 'memcache' or 'cmemcache' library"
|
||||
)
|
||||
import memcache
|
||||
except:
|
||||
raise InvalidCacheBackendError(
|
||||
"Memcached cache backend requires either the 'memcache' or 'cmemcache' library"
|
||||
)
|
||||
super(CacheClass, self).__init__(server, params,
|
||||
library=memcache,
|
||||
value_not_found_exception=ValueError)
|
||||
|
||||
Reference in New Issue
Block a user