MCPcopy Create free account
hub / github.com/chubin/cheat.sh / get

Function get

lib/cache.py:49–64  ·  view source on GitHub ↗

Read `value` by `key`, and deserialize it if needed

(key)

Source from the content-addressed store, hash-verified

47
48
49def get(key):
50 """
51 Read `value` by `key`, and deserialize it if needed
52 """
53
54 if _REDIS_PREFIX:
55 key = _REDIS_PREFIX + key
56
57 if CONFIG["cache.type"] == "redis" and _REDIS:
58 value = _REDIS.get(key)
59 try:
60 value = json.loads(value)
61 except (ValueError, TypeError):
62 pass
63 return value
64 return None
65
66
67def delete(key):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected