diff options
| author | Tim Graham <timograham@gmail.com> | 2014-12-26 11:46:48 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-17 09:55:18 -0500 |
| commit | d038c547b5ce585cbf9ef5bb7e5298f52e4a243b (patch) | |
| tree | f662bb3059ce87c8d3401838e7bf5702bd1ece17 /django/core/cache/__init__.py | |
| parent | aff0e54d511f55dbcdbae6a79c237fbb3edc9973 (diff) | |
Removed django.core.cache.get_cache() per deprecation timeline; refs #21012.
Diffstat (limited to 'django/core/cache/__init__.py')
| -rw-r--r-- | django/core/cache/__init__.py | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index 63b739f1de..e5296814a3 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -13,19 +13,17 @@ object. See docs/topics/cache.txt for information on the public API. """ from threading import local -import warnings from django.conf import settings from django.core import signals from django.core.cache.backends.base import ( InvalidCacheBackendError, CacheKeyWarning, BaseCache) from django.core.exceptions import ImproperlyConfigured -from django.utils.deprecation import RemovedInDjango19Warning from django.utils.module_loading import import_string __all__ = [ - 'get_cache', 'cache', 'DEFAULT_CACHE_ALIAS', 'InvalidCacheBackendError', + 'cache', 'DEFAULT_CACHE_ALIAS', 'InvalidCacheBackendError', 'CacheKeyWarning', 'BaseCache', ] @@ -35,33 +33,6 @@ if DEFAULT_CACHE_ALIAS not in settings.CACHES: raise ImproperlyConfigured("You must define a '%s' cache" % DEFAULT_CACHE_ALIAS) -def get_cache(backend, **kwargs): - """ - Function to create a cache backend dynamically. This is flexible by design - to allow different use cases: - - To load a backend that is pre-defined in the settings:: - - cache = get_cache('default') - - To create a backend with its dotted import path, - including arbitrary options:: - - cache = get_cache('django.core.cache.backends.memcached.MemcachedCache', **{ - 'LOCATION': '127.0.0.1:11211', 'TIMEOUT': 30, - }) - - """ - warnings.warn("'get_cache' is deprecated in favor of 'caches'.", - RemovedInDjango19Warning, stacklevel=2) - cache = _create_cache(backend, **kwargs) - # Some caches -- python-memcached in particular -- need to do a cleanup at the - # end of a request cycle. If not implemented in a particular backend - # cache.close is a no-op - signals.request_finished.connect(cache.close) - return cache - - def _create_cache(backend, **kwargs): try: # Try to get the CACHES entry for the given backend name first |
