Ticket #7398: ease-custom-cache-backends.diff
File ease-custom-cache-backends.diff, 1.4 KB (added by , 16 years ago) |
---|
-
django/core/cache/__init__.py
20 20 from django.core.cache.backends.base import InvalidCacheBackendError 21 21 22 22 BACKENDS = { 23 # name for use in settings file --> name of module in "backends" directory24 'memcached': ' memcached',25 'locmem': ' locmem',26 'file': ' filebased',27 'db': 'd b',28 'dummy': 'd ummy',23 # name for use in settings file --> path to the backend module 24 'memcached': 'django.core.cache.backends.memcached', 25 'locmem': 'django.core.cache.backends.locmem', 26 'file': 'django.core.cache.backends.filebased', 27 'db': 'django.core.cache.backends.db', 28 'dummy': 'django.core.cache.backends.dummy', 29 29 } 30 30 31 if hasattr(settings, "CACHE_BACKEND_MODULES"): 32 BACKENDS.update(settings.CACHE_BACKEND_MODULES) 33 31 34 DEPRECATED_BACKENDS = { 32 35 # deprecated backend --> replacement module 33 36 'simple': 'locmem', … … 57 60 if host.endswith('/'): 58 61 host = host[:-1] 59 62 60 cache_class = getattr(__import__( 'django.core.cache.backends.%s' %BACKENDS[scheme], {}, {}, ['']), 'CacheClass')63 cache_class = getattr(__import__(BACKENDS[scheme], {}, {}, ['']), 'CacheClass') 61 64 return cache_class(host, params) 62 65 63 66 cache = get_cache(settings.CACHE_BACKEND)