forked from phoenix/litellm-mirror
use consistent key name for increment op
This commit is contained in:
parent
c4937dffe2
commit
be25706736
2 changed files with 5 additions and 5 deletions
|
@ -902,11 +902,11 @@ class RedisCache(BaseCache):
|
||||||
for increment_op in increment_list:
|
for increment_op in increment_list:
|
||||||
cache_key = self.check_and_fix_namespace(key=increment_op["key"])
|
cache_key = self.check_and_fix_namespace(key=increment_op["key"])
|
||||||
print_verbose(
|
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"])
|
pipe.incrbyfloat(cache_key, increment_op["increment_value"])
|
||||||
if increment_op["ttl_seconds"] is not None:
|
if increment_op["ttl"] is not None:
|
||||||
_td = timedelta(seconds=increment_op["ttl_seconds"])
|
_td = timedelta(seconds=increment_op["ttl"])
|
||||||
pipe.expire(cache_key, _td)
|
pipe.expire(cache_key, _td)
|
||||||
# Execute the pipeline and return results
|
# Execute the pipeline and return results
|
||||||
results = await pipe.execute()
|
results = await pipe.execute()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Literal, TypedDict
|
from typing import Literal, Optional, TypedDict
|
||||||
|
|
||||||
|
|
||||||
class LiteLLMCacheType(str, Enum):
|
class LiteLLMCacheType(str, Enum):
|
||||||
|
@ -32,4 +32,4 @@ class RedisPipelineIncrementOperation(TypedDict):
|
||||||
|
|
||||||
key: str
|
key: str
|
||||||
increment_value: float
|
increment_value: float
|
||||||
ttl_seconds: int
|
ttl: Optional[int]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue