Skip to main content

RedisCache

Implementation of AbstractCache using the Redis database.
This class provides a concrete implementation of the AbstractCache interface using the Redis database for caching data.
Attributes:
seed (Union[str, int]): A seed or namespace used as a prefix for cache keys.
cache (redis.Redis): The Redis client used for caching.
Methods:
init(self, seed, redis_url): Initializes the RedisCache with the given seed and Redis URL.
_prefixed_key(self, key): Internal method to get a namespaced cache key.
get(self, key, default=None): Retrieves an item from the cache.
set(self, key, value): Sets an item in the cache.
close(self): Closes the Redis client.
enter(self): Context management entry.
exit(self, exc_type, exc_value, traceback): Context management exit.
Initialize the RedisCache instance.
Parameters:

Instance Methods

close

Close the Redis client.
Perform any necessary cleanup, such as closing network connections.

get

Retrieve an item from the Redis cache.
Parameters: Returns:

set

Set an item in the Redis cache.
Parameters: