This commit is contained in:
Siraj637909 2026-09-29 16:31:00 +08:00 • committed by GitHub
commit 271eb8d48d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -269,10 +269,11 @@ class InMemoryCache(BaseCache):
self._remove_key(key)
async def async_get_ttl(self, key: str) -> int | None:
"""
Get the remaining TTL of a key in in-memory cache
"""
return self.ttl_dict.get(key, None)
"""Get the remaining TTL of a key in in-memory cache"""
expiry = self.ttl_dict.get(key, None)
if expiry is None:
return None
return max(0, expiry - time.time())
async def async_get_oldest_n_keys(self, n: int) -> list[str]:
"""