Jump to >

djblets.cache.forwarding_backend

A cache backend that forwards to other dynamically-configured backends.

class ForwardingCacheBackend(cache_name=u'forwarded_backend', *args, **kwargs)[source]

Bases: object

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.py and restarting the app.

This by default looks for another cache backend in settings.CACHES['forwarded_backend']. This can be changed with the LOCATION setting 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.

__init__(cache_name=u'forwarded_backend', *args, **kwargs)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

backend[source]

Return the forwarded cache backend.

reset_backend()[source]

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)[source]

Close the cache backend.

__contains__(key)[source]
__getattribute__(name)[source]

x.__getattribute__(‘name’) <==> x.name