base
CacheDBConfig
¶
Bases: BaseSettings
Configuration model for CacheDB.
CacheDB
¶
Bases: ABC
Abstract base class for a cache database.
store(key, value)
abstractmethod
¶
Abstract method to store a value associated with a key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The key under which to store the value. |
required |
value |
Any
|
The value to store. |
required |
retrieve(key)
abstractmethod
¶
Abstract method to retrieve the value associated with a key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The key to retrieve the value for. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Dict[str, Any] | str | None
|
The value associated with the key. |
Source code in langroid/cachedb/base.py
delete_keys(keys)
abstractmethod
¶
Delete the keys from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys |
List[str]
|
The keys to delete. |
required |
delete_keys_pattern(pattern)
abstractmethod
¶
Delete all keys with the given pattern
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix |
str
|
The pattern to match. |
required |