autogen_ext.cache_store.redis#
- class RedisStore(redis_instance: Redis)[source]#
Bases:
CacheStore
[T
],Component
[RedisStoreConfig
]A typed CacheStore implementation that uses redis as the underlying storage. See
ChatCompletionCache
for an example of usage.- Parameters:
cache_instance – An instance of redis.Redis. The user is responsible for managing the Redis instance’s lifetime.
- classmethod _from_config(config: RedisStoreConfig) Self [source]#
Create a new instance of the component from a configuration object.
- Parameters:
config (T) – The configuration object.
- Returns:
Self – The new instance of the component.
- _to_config() RedisStoreConfig [source]#
Dump the configuration that would be requite to create a new instance of a component matching the configuration of this instance.
- Returns:
T – The configuration of the component.
- component_config_schema#
alias of
RedisStoreConfig
- component_provider_override: ClassVar[str | None] = 'autogen_ext.cache_store.redis.RedisStore'#
Override the provider string for the component. This should be used to prevent internal module names being a part of the module name.
- get(key: str, default: T | None = None) T | None [source]#
Retrieve an item from the store.
- Parameters:
key – The key identifying the item in the store.
default (optional) – The default value to return if the key is not found. Defaults to None.
- Returns:
The value associated with the key if found, else the default value.
- pydantic model RedisStoreConfig[source]#
Bases:
BaseModel
Configuration for RedisStore
Show JSON schema
{ "title": "RedisStoreConfig", "description": "Configuration for RedisStore", "type": "object", "properties": { "host": { "default": "localhost", "title": "Host", "type": "string" }, "port": { "default": 6379, "title": "Port", "type": "integer" }, "db": { "default": 0, "title": "Db", "type": "integer" }, "username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Username" }, "password": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Password" }, "ssl": { "default": false, "title": "Ssl", "type": "boolean" }, "socket_timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Socket Timeout" } } }
- Fields: