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

Method get

src/renderer/features/mentions/search/cache.ts:52–74  ·  view source on GitHub ↗

* Get a value from the cache

(key: string)

Source from the content-addressed store, hash-verified

50 * Get a value from the cache
51 */
52 get<T>(key: string): T | null {
53 const entry = this.cache.get(key)
54
55 if (!entry) {
56 this.misses++
57 return null
58 }
59
60 // Check expiration
61 if (Date.now() > entry.expires) {
62 this.cache.delete(key)
63 this.misses++
64 return null
65 }
66
67 // Update hit count and move to end (LRU)
68 entry.hitCount++
69 this.cache.delete(key)
70 this.cache.set(key, entry)
71
72 this.hits++
73 return entry.value as T
74 }
75
76 /**
77 * Set a value in the cache

Callers 15

getColorFunction · 0.45
getFontStyleFunction · 0.45
registerMonacoThemeFunction · 0.45
terminal-tabs.tsxFile · 0.45
AgentsSubChatsSidebarFunction · 0.45
agents-sidebar.tsxFile · 0.45
AgentsSidebarFunction · 0.45
groupFilesByFolderFunction · 0.45
getServersFromContextFunction · 0.45
searchMethod · 0.45
searchProviderMethod · 0.45
mcp-widget.tsxFile · 0.45

Calls 2

deleteMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected