MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / AbstractCache

Class AbstractCache

cache/abs_cache.py:31–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class AbstractCache(ABC):
32
33 @abstractmethod
34 def get(self, key: str) -> Optional[Any]:
35 """
36 Get the value of a key from the cache.
37 This is an abstract method. Subclasses must implement this method.
38 :param key: The key
39 :return:
40 """
41 raise NotImplementedError
42
43 @abstractmethod
44 def set(self, key: str, value: Any, expire_time: int) -> None:
45 """
46 Set the value of a key in the cache.
47 This is an abstract method. Subclasses must implement this method.
48 :param key: The key
49 :param value: The value
50 :param expire_time: Expiration time
51 :return:
52 """
53 raise NotImplementedError
54
55 @abstractmethod
56 def keys(self, pattern: str) -> List[str]:
57 """
58 Get all keys matching the pattern
59 :param pattern: Matching pattern
60 :return:
61 """
62 raise NotImplementedError

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected