MCPcopy Create free account
hub / github.com/anomalyco/opencode / cacheSet

Function cacheSet

packages/app/src/utils/persist.ts:55–68  ·  view source on GitHub ↗
(key: string, value: string)

Source from the content-addressed store, hash-verified

53}
54
55function cacheSet(key: string, value: string) {
56 const bytes = value.length * 2
57 if (bytes > CACHE_MAX_BYTES) {
58 cacheDelete(key)
59 return
60 }
61
62 const entry = cache.get(key)
63 if (entry) cacheTotal.bytes -= entry.bytes
64 cache.delete(key)
65 cache.set(key, { value, bytes })
66 cacheTotal.bytes += bytes
67 cachePrune()
68}
69
70function cacheGet(key: string) {
71 const entry = cache.get(key)

Callers 4

evictFunction · 0.85
writeFunction · 0.85
localStorageWithPrefixFunction · 0.85
localStorageDirectFunction · 0.85

Calls 5

cacheDeleteFunction · 0.85
cachePruneFunction · 0.85
getMethod · 0.65
deleteMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected