The cache backends is used to store references to already created thumbnails in order to
avoid unnecessary disk or network usage. The
Thumbnail object is cached and will be returned
get_thumbnail if the cache returns it.
Extendible cache backend that should be used when creating a new cache backend. Subclasses should only override methods prefixed with
Backend specific handling of get, should be overridden by subclasses.
Parameters: thumbnail_name – String or list with the name/hash of the thumbnail. Return type: Thumbnail
Backend specific handling of set, should be overridden by subclasses.
- thumbnail_name – String with the name of the thumbnail.
- thumbnail – The Thumbnail object that should be cached.
_get, which converts the thumbnail_name to String if necessary before calling
Return type: Thumbnail
Cache backend that stores objects in a dict on the backend instance.
Cache backend that uses Django’s cache.
Cache backend that connects to Redis with redis-py. It uses the
THUMBNAIL_CACHE_CONNECTION_URIsetting as connection configuration. The setting should contain a string on the form:
redis://127.0.0.1:6379/0will give the default settings. This backend does not sett time-to-live on the cached items, thus they will be in redis until they are deleted.
If the settings string is not good enough for your configuration, it is possible to extend this backend and override
This creates a dict with keyword arguments used to create the redis client. It is used like
redis.StrictClient(**self.get_settings()). Thus, if the settings string is not enough to generate the wanted setting you can override this function.
Returns: A dict with keyword arguments for the redis client constructor.