🐛 fix(manager.py): handle None key in __contains__ method to prevent Redis client error when checking if key exists in cache

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-15 23:24:26 -03:00
commit 507d6a756d

View file

@ -292,7 +292,7 @@ class RedisCache(BaseCacheService, Service):
def __contains__(self, key):
"""Check if the key is in the cache."""
return self._client.exists(key)
return False if key is None else self._client.exists(key)
def __getitem__(self, key):
"""Retrieve an item from the cache using the square bracket notation."""