From be25706736c82c27e45aec25ccf8297ea5d5b01e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sun, 24 Nov 2024 10:22:00 -0800 Subject: [PATCH] use consistent key name for increment op --- litellm/caching/redis_cache.py | 6 +++--- litellm/types/caching.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.py index 58ef51557..1cabbd4f9 100644 --- a/litellm/caching/redis_cache.py +++ b/litellm/caching/redis_cache.py @@ -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() diff --git a/litellm/types/caching.py b/litellm/types/caching.py index 644c6e8be..a6f9de308 100644 --- a/litellm/types/caching.py +++ b/litellm/types/caching.py @@ -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]