diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.py index ed0a22d78a7..263e1df2ee7 100644 --- a/litellm/caching/redis_cache.py +++ b/litellm/caching/redis_cache.py @@ -365,12 +365,12 @@ class RedisCache(BaseCache): self.redis_async_client = redis_async_client # type: ignore return redis_async_client - def check_and_fix_namespace(self, key: Optional[str]) -> Optional[str]: + def check_and_fix_namespace(self, key: str) -> str: """ Make sure each key starts with the given namespace """ if key is None: - return key + return key # type: ignore[return-value] if self.namespace is not None and not key.startswith(self.namespace): key = self.namespace + ":" + key