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

Method get

cache/local_cache.py:56–71  ·  view source on GitHub ↗

Get the value of a key from the cache :param key: :return:

(self, key: str)

Source from the content-addressed store, hash-verified

54 self._cron_task.cancel()
55
56 def get(self, key: str) -> Optional[Any]:
57 """
58 Get the value of a key from the cache
59 :param key:
60 :return:
61 """
62 value, expire_time = self._cache_container.get(key, (None, 0))
63 if value is None:
64 return None
65
66 # If the key has expired, delete it and return None
67 if expire_time < time.time():
68 del self._cache_container[key]
69 return None
70
71 return value
72
73 def set(self, key: str, value: Any, expire_time: int) -> None:
74 """

Callers 1

local_cache.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected