mirror of
https://github.com/django/django.git
synced 2025-10-18 06:18:18 +00:00
Fixed #21012 -- New API to access cache backends.
Thanks Curtis Malony and Florian Apolloner. Squashed commit of the following: commit3380495e93
Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sat Nov 23 14:18:07 2013 +0100 Looked up the template_fragments cache at runtime. commit905a74f52b
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. commit35e289fe92
Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sat Nov 23 12:23:57 2013 +0100 Removed create_cache function. commit8e274f747a
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. commitee7eb0f73e
Author: Curtis Maloney <curtis@tinbrain.net> Date: Sat Oct 19 09:49:24 2013 +1100 Fixed #21012 -- Thread-local caches, like databases.
This commit is contained in:
parent
3ca0815c0b
commit
ffc37e2343
16 changed files with 729 additions and 606 deletions
|
@ -7,7 +7,7 @@ import posixpath
|
|||
import re
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.cache import (get_cache, InvalidCacheBackendError,
|
||||
from django.core.cache import (caches, InvalidCacheBackendError,
|
||||
cache as default_cache)
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.files.base import ContentFile
|
||||
|
@ -56,7 +56,7 @@ class CachedFilesMixin(object):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(CachedFilesMixin, self).__init__(*args, **kwargs)
|
||||
try:
|
||||
self.cache = get_cache('staticfiles')
|
||||
self.cache = caches['staticfiles']
|
||||
except InvalidCacheBackendError:
|
||||
# Use the default backend
|
||||
self.cache = default_cache
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue