[fix] cache.ExpireCache: definition of a context name for the key

The definition of a context name belongs in the abstract base class (was
previously only in the concrete implementation for the SQLite adapter).

Suggested-by: @dalf https://github.com/searxng/searxng/pull/4650#discussion_r2069873853
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2025-05-01 11:31:29 +02:00 committed by Markus Heiser
parent 7351c38e6c
commit 8ef5fbca4e
2 changed files with 39 additions and 24 deletions

View file

@ -161,11 +161,11 @@ class EngineCache:
key=key,
value=value,
expire=expire or self.expire,
table=self.table_name,
ctx=self.table_name,
)
def get(self, key: str, default=None) -> Any:
return ENGINES_CACHE.get(key, default=default, table=self.table_name)
return ENGINES_CACHE.get(key, default=default, ctx=self.table_name)
def secret_hash(self, name: str | bytes) -> str:
return ENGINES_CACHE.secret_hash(name=name)