Skip to main content

RedisStorage

A concrete implementation of the :obj:BaseCacheStorage using Redis as the backend. This is suitable for distributed cache systems that require persistence and high availability.

init

Initializes the RedisStorage instance with the provided URL and options. Parameters:
  • sid (str): The ID for the storage instance to identify the record space.
  • url (str): The URL for connecting to the Redis server. **kwargs: Additional keyword arguments for Redis client configuration.

enter

exit

_create_client

Creates the Redis client with the provided URL and options.

client

Returns: redis.asyncio.Redis: The Redis client instance.

save

Saves a batch of records to the key-value storage system.

load

Returns: List[Dict[str, Any]]: A list of dictionaries, where each dictionary represents a stored record.

clear

Removes all records from the key-value storage system.

_run_async