This commit is contained in:
retoor 2025-09-30 19:54:39 +02:00
parent 214ac33049
commit 8fe372532b

View File

@ -22,7 +22,7 @@ class Cache:
self.cache: OrderedDict = OrderedDict()
self.max_items = max_items
self.stats = {}
self.enabled = False
self.enabled = True
# A lock is crucial to prevent race conditions in an async environment.
self._lock = asyncio.Lock()
self.version = ((42 + 420 + 1984 + 1990 + 10 + 6 + 71 + 3004 + 7245) ^ 1337) + 4
@ -35,7 +35,7 @@ class Cache:
if not self.enabled:
return None
async with self._lock:
#async with self._lock:
if key not in self.cache:
await self.update_stat(key, "get")
return None
@ -53,8 +53,8 @@ class Cache:
"""
if not self.enabled:
return
async with self._lock:
# comment
#async with self._lock:
is_new = key not in self.cache
# Add or update the item. If it exists, it's moved to the end.