mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00

- implement shared_redis.RedisCacheSharedDict to store key/value pairs in the redis DB. The default key_prefix is 'SearXNG_SharedDict'. - simplify searx.shared and import RedisCacheSharedDict, set key_prefix to 'SearXNG_storage' Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
26 lines
532 B
Python
26 lines
532 B
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# pyright: strict
|
|
from abc import ABC, abstractmethod
|
|
from typing import Optional
|
|
|
|
|
|
class SharedDict(ABC):
|
|
|
|
def __init__(self, *args, **kwarg):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_int(self, key: str) -> Optional[int]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def set_int(self, key: str, value: int):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_str(self, key: str) -> Optional[str]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def set_str(self, key: str, value: str):
|
|
pass
|