redis_func_cache.policies.base module#
Base class for single-pair cache.
- class redis_func_cache.policies.base.BaseClusterMultiplePolicy[source]#
Bases:
BaseMultiplePolicyBase policy for multiple sorted-set or hash-map key pairs with Redis cluster support.
Each decorated function using this policy has its own Redis key pair.
Not intended for direct use.
- Parameters:
cache – Optional weakref proxy to the
RedisFuncCacheinstance using this policy.
Note
The cache argument may be omitted when instantiating a policy. The RedisFuncCache will bind itself to the policy instance by setting this attribute to a weakref proxy during cache construction.
- class redis_func_cache.policies.base.BaseClusterSinglePolicy[source]#
Bases:
BaseSinglePolicyBase policy for a single sorted-set or hash-map key pair with Redis cluster support.
All decorated functions using this policy share the same Redis key pair.
Not intended for direct use.
- Parameters:
cache – Optional weakref proxy to the
RedisFuncCacheinstance using this policy.
Note
The cache argument may be omitted when instantiating a policy. The RedisFuncCache will bind itself to the policy instance by setting this attribute to a weakref proxy during cache construction.
- class redis_func_cache.policies.base.BaseMultiplePolicy[source]#
Bases:
AbstractPolicyBase policy for multiple sorted-set or hash-map key pairs.
Each decorated function using this policy has its own Redis key pair.
Not intended for direct use.
- Parameters:
cache – Optional weakref proxy to the
RedisFuncCacheinstance using this policy.
Note
The cache argument may be omitted when instantiating a policy. The RedisFuncCache will bind itself to the policy instance by setting this attribute to a weakref proxy during cache construction.
- async apurge()[source]#
Delete all Redis keys for this policy asynchronously.
- Return type:
- Returns:
Number of keys deleted.
- class redis_func_cache.policies.base.BaseSinglePolicy[source]#
Bases:
AbstractPolicyBase policy for a single sorted-set or hash-map key pair.
All decorated functions using this policy share the same Redis key pair.
Not intended for direct use.
- Parameters:
cache – Optional weakref proxy to the
RedisFuncCacheinstance using this policy.
Note
The cache argument may be omitted when instantiating a policy. The RedisFuncCache will bind itself to the policy instance by setting this attribute to a weakref proxy during cache construction.
- async aget_size()[source]#
Get the number of items in the cache asynchronously.
- Return type:
- Returns:
Number of items in the cache.
- async apurge()[source]#
Delete the cache’s Redis keys asynchronously.
- Return type:
- Returns:
Number of keys deleted.
- calc_keys(f=None, args=None, kwds=None)[source]#
Return the static Redis key pair for this cache policy.