providers.redis.RedisDtoKeyValueStore

Redis-specific KVStore provider for Pydantic model (DTO) data.

Usage

Source

providers.redis.RedisDtoKeyValueStore()

This store allows arbitrary DTOs (Pydantic models) to be stored as values, with the DTO model passed in the constructor. DTOs are serialized using Pydantic’s model_dump, converted to JSON, and stored as UTF-8 bytes.

Methods

Name Description
__init__() Initialize the provider with configuration, model type, and key prefix.

__init__()

Initialize the provider with configuration, model type, and key prefix.

Usage

Source

__init__(*, client, config, dto_model, key_prefix)
Parameters
client: Redis

An instance of an async Redis client.

config: RedisConfig

Redis-specific config parameters.

dto_model: type[Dto]

The Pydantic model type to support for values.

key_prefix: str
Prefix for all keys to enable logical separation.