use consistent key name for increment op

This commit is contained in:
Ishaan Jaff 2024-11-24 10:22:00 -08:00
parent c4937dffe2
commit be25706736
2 changed files with 5 additions and 5 deletions

View file

@ -902,11 +902,11 @@ class RedisCache(BaseCache):
for increment_op in increment_list:
cache_key = self.check_and_fix_namespace(key=increment_op["key"])
print_verbose(
f"Increment ASYNC Redis Cache PIPELINE: key: {cache_key}\nValue {increment_op['increment_value']}\nttl={increment_op['ttl_seconds']}"
f"Increment ASYNC Redis Cache PIPELINE: key: {cache_key}\nValue {increment_op['increment_value']}\nttl={increment_op['ttl']}"
)
pipe.incrbyfloat(cache_key, increment_op["increment_value"])
if increment_op["ttl_seconds"] is not None:
_td = timedelta(seconds=increment_op["ttl_seconds"])
if increment_op["ttl"] is not None:
_td = timedelta(seconds=increment_op["ttl"])
pipe.expire(cache_key, _td)
# Execute the pipeline and return results
results = await pipe.execute()

View file

@ -1,5 +1,5 @@
from enum import Enum
from typing import Literal, TypedDict
from typing import Literal, Optional, TypedDict
class LiteLLMCacheType(str, Enum):
@ -32,4 +32,4 @@ class RedisPipelineIncrementOperation(TypedDict):
key: str
increment_value: float
ttl_seconds: int
ttl: Optional[int]