redis_cachedb
langroid/cachedb/redis_cachedb.py
RedisCacheConfig
¶
RedisCache(config)
¶
Bases: CacheDB
Redis implementation of the CacheDB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
RedisCacheConfig
|
The configuration to use. |
required |
Source code in langroid/cachedb/redis_cachedb.py
redis_client()
¶
Cleanly open and close a redis client, avoids max clients exceeded error
Source code in langroid/cachedb/redis_cachedb.py
clear()
¶
clear_all()
¶
store(key, value)
¶
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 |
Source code in langroid/cachedb/redis_cachedb.py
retrieve(key)
¶
Retrieve the value associated with a key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The key to retrieve the value for. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any] | str | None
|
dict|str|None: The value associated with the key. |
Source code in langroid/cachedb/redis_cachedb.py
delete_keys(keys)
¶
Delete the keys from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys |
List[str]
|
The keys to delete. |
required |
Source code in langroid/cachedb/redis_cachedb.py
delete_keys_pattern(pattern)
¶
Delete the keys matching the pattern from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix |
str
|
The pattern to match. |
required |