(Testing) Add unit testing for DualCache - ensure in memory cache is used when expected (#6471)

* test test_dual_cache_get_set

* unit testing for dual cache

* fix async_set_cache_sadd

* test_dual_cache_local_only
This commit is contained in:
Ishaan Jaff 2024-10-29 08:42:57 +05:30 committed by GitHub
parent c1bfbc882f
commit 9e57efc06d
3 changed files with 246 additions and 2 deletions

View file

@ -63,7 +63,7 @@ class InMemoryCache(BaseCache):
self.evict_cache()
self.cache_dict[key] = value
if "ttl" in kwargs:
if "ttl" in kwargs and kwargs["ttl"] is not None:
self.ttl_dict[key] = time.time() + kwargs["ttl"]
else:
self.ttl_dict[key] = time.time() + self.default_ttl