MCPcopy Create free account
hub / github.com/TonyLianLong/LLM-groundedDiffusion / get_cache

Function get_cache

utils/cache.py:42–58  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

40 global_cache = json.load(f)
41
42def get_cache(key):
43 if key not in global_cache:
44 global_cache[key] = []
45
46 if key not in global_cache_index:
47 global_cache_index[key] = 0
48
49 current_items = global_cache[key]
50 current_index = global_cache_index[key]
51 if len(current_items) > current_index:
52 global_cache_index[key] += 1
53 if key not in cache_queries:
54 cache_queries[key] = []
55 cache_queries[key].append(current_items[current_index])
56 return current_items[current_index]
57
58 return None
59
60def add_cache(key, value):
61 global_cache_index[key] += 1

Callers 1

get_layout_with_cacheFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected