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

Function put

lib/cache.py:34–46  ·  view source on GitHub ↗

Save `value` with `key`, and serialize it if needed

(key, value)

Source from the content-addressed store, hash-verified

32
33
34def put(key, value):
35 """
36 Save `value` with `key`, and serialize it if needed
37 """
38
39 if _REDIS_PREFIX:
40 key = _REDIS_PREFIX + key
41
42 if CONFIG["cache.type"] == "redis" and _REDIS:
43 if isinstance(value, (dict, list)):
44 value = json.dumps(value)
45
46 _REDIS.set(key, value)
47
48
49def get(key):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected