From: Marcel van der Veldt Date: Fri, 25 Oct 2024 00:44:23 +0000 (+0200) Subject: Limit cache db a bit X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=29f28e85211f3348c4ea2984fb00a2db26eb6281;p=music-assistant-server.git Limit cache db a bit --- diff --git a/music_assistant/server/controllers/cache.py b/music_assistant/server/controllers/cache.py index 704c96b6..5e29edd7 100644 --- a/music_assistant/server/controllers/cache.py +++ b/music_assistant/server/controllers/cache.py @@ -129,7 +129,7 @@ class CacheController(CoreController): return default async def set( - self, key, data, checksum="", expiration=(86400 * 30), category: int = 0, base_key: str = "" + self, key, data, checksum="", expiration=(86400 * 7), category: int = 0, base_key: str = "" ) -> None: """Set data in cache.""" if not key: @@ -139,7 +139,7 @@ class CacheController(CoreController): expires = int(time.time() + expiration) memory_key = f"{category}/{base_key}/{key}" self._mem_cache[memory_key] = (data, checksum, expires) - if (expires - time.time()) < 3600 * 4: + if (expires - time.time()) < 3600 * 12: # do not cache items in db with short expiration return data = await asyncio.to_thread(json_dumps, data)