Fixed #18220 -- Removed the CACHE_BACKEND setting, as per official deprecation timeline.
Thanks Ramiro Morales for the review.
This commit is contained in:
parent
5b644a5464
commit
eefb00f301
|
@ -464,11 +464,12 @@ SESSION_FILE_PATH = None # Directory to store ses
|
||||||
# CACHE #
|
# CACHE #
|
||||||
#########
|
#########
|
||||||
|
|
||||||
# New format
|
# The cache backends to use.
|
||||||
CACHES = {
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# The cache backend to use. See the docstring in django.core.cache for the
|
|
||||||
# possible values.
|
|
||||||
CACHE_MIDDLEWARE_KEY_PREFIX = ''
|
CACHE_MIDDLEWARE_KEY_PREFIX = ''
|
||||||
CACHE_MIDDLEWARE_SECONDS = 600
|
CACHE_MIDDLEWARE_SECONDS = 600
|
||||||
CACHE_MIDDLEWARE_ALIAS = 'default'
|
CACHE_MIDDLEWARE_ALIAS = 'default'
|
||||||
|
|
|
@ -64,42 +64,6 @@ def parse_backend_uri(backend_uri):
|
||||||
|
|
||||||
return scheme, host, params
|
return scheme, host, params
|
||||||
|
|
||||||
if not settings.CACHES:
|
|
||||||
legacy_backend = getattr(settings, 'CACHE_BACKEND', None)
|
|
||||||
if legacy_backend:
|
|
||||||
import warnings
|
|
||||||
warnings.warn(
|
|
||||||
"settings.CACHE_* is deprecated; use settings.CACHES instead.",
|
|
||||||
DeprecationWarning
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
# The default cache setting is put here so that we
|
|
||||||
# can differentiate between a user who has provided
|
|
||||||
# an explicit CACHE_BACKEND of locmem://, and the
|
|
||||||
# default value. When the deprecation cycle has completed,
|
|
||||||
# the default can be restored to global_settings.py
|
|
||||||
settings.CACHE_BACKEND = 'locmem://'
|
|
||||||
|
|
||||||
# Mapping for new-style cache backend api
|
|
||||||
backend_classes = {
|
|
||||||
'memcached': 'memcached.CacheClass',
|
|
||||||
'locmem': 'locmem.LocMemCache',
|
|
||||||
'file': 'filebased.FileBasedCache',
|
|
||||||
'db': 'db.DatabaseCache',
|
|
||||||
'dummy': 'dummy.DummyCache',
|
|
||||||
}
|
|
||||||
engine, host, params = parse_backend_uri(settings.CACHE_BACKEND)
|
|
||||||
if engine in backend_classes:
|
|
||||||
engine = 'django.core.cache.backends.%s' % backend_classes[engine]
|
|
||||||
else:
|
|
||||||
engine = '%s.CacheClass' % engine
|
|
||||||
defaults = {
|
|
||||||
'BACKEND': engine,
|
|
||||||
'LOCATION': host,
|
|
||||||
}
|
|
||||||
defaults.update(params)
|
|
||||||
settings.CACHES[DEFAULT_CACHE_ALIAS] = defaults
|
|
||||||
|
|
||||||
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
|
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
|
||||||
raise ImproperlyConfigured("You must define a '%s' cache" % DEFAULT_CACHE_ALIAS)
|
raise ImproperlyConfigured("You must define a '%s' cache" % DEFAULT_CACHE_ALIAS)
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,8 @@ these changes.
|
||||||
library earlier than 2.1. An accelerated timeline was used as this was
|
library earlier than 2.1. An accelerated timeline was used as this was
|
||||||
a security related deprecation.
|
a security related deprecation.
|
||||||
|
|
||||||
|
* The ``CACHE_BACKEND`` setting will be removed. The cache backend(s) should be
|
||||||
|
specified in the :setting:`CACHES` setting.
|
||||||
|
|
||||||
1.6
|
1.6
|
||||||
---
|
---
|
||||||
|
|
|
@ -2311,15 +2311,6 @@ ADMIN_MEDIA_PREFIX
|
||||||
integration. See the :doc:`Django 1.4 release notes</releases/1.4>` for
|
integration. See the :doc:`Django 1.4 release notes</releases/1.4>` for
|
||||||
more information.
|
more information.
|
||||||
|
|
||||||
.. setting:: CACHE_BACKEND
|
|
||||||
|
|
||||||
CACHE_BACKEND
|
|
||||||
-------------
|
|
||||||
|
|
||||||
.. deprecated:: 1.3
|
|
||||||
This setting has been replaced by :setting:`BACKEND <CACHES-BACKEND>` in
|
|
||||||
:setting:`CACHES`.
|
|
||||||
|
|
||||||
.. setting:: IGNORABLE_404_ENDS
|
.. setting:: IGNORABLE_404_ENDS
|
||||||
|
|
||||||
IGNORABLE_404_ENDS
|
IGNORABLE_404_ENDS
|
||||||
|
|
Loading…
Reference in New Issue