A cache backend that forwards to other dynamically-configured backends.
- class ForwardingCacheBackend(cache_name='forwarded_backend', *args, **kwargs)¶
Forwards requests to another cache backend.
This is used to allow for dynamic configuration of caches that can be swapped in and out. By setting this cache backend as the default backend, the consumer can easily switch between other cache backends without modifying
settings.pyand restarting the app.
This by default looks for another cache backend in
settings.CACHES['forwarded_backend']. This can be changed with the
LOCATIONsetting for this cache backend. All requests and attribute lookups will be forwarded there.
If a consumer switches the real cache backend, it can call
reset_backend(), and all future cache requests will go to the newly computed backend.
- property backend¶
Return the forwarded cache backend.
Reset the forwarded cache backend.
This must be called after modifying
settings.CACHES['forwarded_backend']in order for the new backend to be picked up.
- close(*args, **kwargs)¶
Close the cache backend.