MCPcopy
hub / github.com/21st-dev/1code / set

Method set

src/main/lib/git/cache/git-cache.ts:73–92  ·  view source on GitHub ↗

* Set an entry in the cache.

(key: string, data: T, hash: string, sizeBytes = 0)

Source from the content-addressed store, hash-verified

71 * Set an entry in the cache.
72 */
73 set(key: string, data: T, hash: string, sizeBytes = 0): void {
74 // Evict if necessary
75 this.evictIfNeeded(sizeBytes);
76
77 // Delete existing entry first to update size tracking
78 if (this.cache.has(key)) {
79 this.delete(key);
80 }
81
82 const entry: CacheEntry<T> = {
83 data,
84 hash,
85 timestamp: Date.now(),
86 accessCount: 1,
87 sizeBytes,
88 };
89
90 this.cache.set(key, entry);
91 this.currentSizeBytes += sizeBytes;
92 }
93
94 /**
95 * Delete an entry from the cache.

Callers 15

handleAuthCodeFunction · 0.45
index.tsFile · 0.45
buildParamsFunction · 0.45
registerMethod · 0.45
claimChatMethod · 0.45
exchangeCodeForTokensMethod · 0.45
authenticateMethod · 0.45
startAuthFlowMethod · 0.45
startMcpOAuthFunction · 0.45
saveMethod · 0.45
createBranchesRouterFunction · 0.45
withGitLockFunction · 0.45

Calls 3

evictIfNeededMethod · 0.95
deleteMethod · 0.95
hasMethod · 0.45

Tested by

no test coverage detected