This module implements CacheManager class.
This is the base class for cache managers.
key_base is used to prefix cache keys generated by this instance.
ttl is cache key TTL in seconds. If it is omitted (or None) then keys stored by this instance won’t expire.
connection allows binding the instance to an explicit Redis connection. If it is omitted global connection defined with redcache.connection.use_connection() will be used.
If no connection is defined then no caching will happen.
Process and return data after loading it from Redis. f_args and f_kwargs contain positional and keywords args passed to decorated function.
Default implementation uses cPickle to unserialize data.
Process and return data before saving it to Redis. f_args and f_kwargs contain positional and keywords args passed to decorated function.
Default implementation uses cPickle to unserialize data.
Decorate f function to enable caching it.
If the function returns None then it won’t be cached.
Key generator for function f with positional arguments args.
Example key: key_base:func_name:arg1:arg2.
Instance and class methods
If the first argument of f is either self or cls it won’t be used while creating the key.
This is default cache manager for simple caching of generic functions.
Basically it’s equivalent to CacheManager with default settings.