djblets.cache.backend_compat¶
Compatibility functions for older Django cache backend configuration.
These functions are used to maintain compatibility or transition settings from older versions of Django.
- normalize_cache_backend(cache_backend, cache_name='default')[source]¶
Return a new-style
CACHES
dictionary from any given cache_backend.Over time, Django has had support for two formats for a cache backend. The old-style
CACHE_BACKEND
string, and the new-styleCACHES
dictionary.This function will accept either as input and return a dictionary containing a single normalized entry for the given cache backend. This can be merged into the existing
CACHES
setting.If a
CACHES
dictionary is passed, the “default” cache will be the result.- Parameters:
- Returns:
A new-style cache backend dictionary containing the single cache backend referenced. If there were any parsing issues, an empty dictionary will be returned.