diff options
author | Curtis Maloney <curtis@tinbrain.net> | 2013-10-19 09:49:24 +1100 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-11-23 15:06:59 +0100 |
commit | ffc37e2343a93cf6d44247e20cd263b41f931716 (patch) | |
tree | ce16f3cc212271f3a4d9f02d25c87b770f09955e /django/utils/cache.py | |
parent | 3ca0815c0b4ddf7dd1fe74839e2c3e8633c3ea31 (diff) | |
download | django-ffc37e2343a93cf6d44247e20cd263b41f931716.tar.gz |
Fixed #21012 -- New API to access cache backends.
Thanks Curtis Malony and Florian Apolloner.
Squashed commit of the following:
commit 3380495e93f5e81b80a251b03ddb0a80b17685f5
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date: Sat Nov 23 14:18:07 2013 +0100
Looked up the template_fragments cache at runtime.
commit 905a74f52b24a198f802520ff06290a94dedc687
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date: Sat Nov 23 14:19:48 2013 +0100
Removed all uses of create_cache.
Refactored the cache tests significantly.
Made it safe to override the CACHES setting.
commit 35e289fe9285feffed3c60657af9279a6a2cfccc
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date: Sat Nov 23 12:23:57 2013 +0100
Removed create_cache function.
commit 8e274f747a1f1c0c0e6c37873e29067f7fa022e8
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date: Sat Nov 23 12:04:52 2013 +0100
Updated docs to describe a simplified cache backend API.
commit ee7eb0f73e6d4699edcf5d357dce715224525cf6
Author: Curtis Maloney <curtis@tinbrain.net>
Date: Sat Oct 19 09:49:24 2013 +1100
Fixed #21012 -- Thread-local caches, like databases.
Diffstat (limited to 'django/utils/cache.py')
-rw-r--r-- | django/utils/cache.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py index 7e38f7b021..d89408a7a2 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -23,7 +23,7 @@ import re import time from django.conf import settings -from django.core.cache import get_cache +from django.core.cache import caches from django.utils.encoding import iri_to_uri, force_bytes, force_text from django.utils.http import http_date from django.utils.timezone import get_current_timezone_name @@ -219,7 +219,7 @@ def get_cache_key(request, key_prefix=None, method='GET', cache=None): key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX cache_key = _generate_cache_header_key(key_prefix, request) if cache is None: - cache = get_cache(settings.CACHE_MIDDLEWARE_ALIAS) + cache = caches[settings.CACHE_MIDDLEWARE_ALIAS] headerlist = cache.get(cache_key, None) if headerlist is not None: return _generate_cache_key(request, method, headerlist, key_prefix) @@ -246,7 +246,7 @@ def learn_cache_key(request, response, cache_timeout=None, key_prefix=None, cach cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS cache_key = _generate_cache_header_key(key_prefix, request) if cache is None: - cache = get_cache(settings.CACHE_MIDDLEWARE_ALIAS) + cache = caches[settings.CACHE_MIDDLEWARE_ALIAS] if response.has_header('Vary'): is_accept_language_redundant = settings.USE_I18N or settings.USE_L10N # If i18n or l10n are used, the generated cache key will be suffixed |