mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 04:04:14 +00:00
handle DB and TTL for redis KV store
This commit is contained in:
parent
46ff302d87
commit
e2d295ae40
2 changed files with 7 additions and 2 deletions
|
@ -26,7 +26,10 @@ class RedisKVStoreImpl(KVStore):
|
|||
|
||||
async def set(self, key: str, value: str, expiration: datetime | None = None) -> None:
|
||||
key = self._namespaced_key(key)
|
||||
await self.redis.set(key, value)
|
||||
if self.config.ttl:
|
||||
await self.redis.set(key, value, ex=self.config.ttl)
|
||||
else:
|
||||
await self.redis.set(key, value)
|
||||
if expiration:
|
||||
await self.redis.expireat(key, expiration)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue