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

Method set

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

* Set a value in the cache

(key: string, value: T, ttl?: number)

Source from the content-addressed store, hash-verified

77 * Set a value in the cache
78 */
79 set<T>(key: string, value: T, ttl?: number): void {
80 // LRU eviction if at capacity
81 if (this.cache.size >= this.maxSize) {
82 const firstKey = this.cache.keys().next().value
83 if (firstKey) {
84 this.cache.delete(firstKey)
85 }
86 }
87
88 this.cache.set(key, {
89 value,
90 expires: Date.now() + (ttl ?? this.defaultTtl),
91 hitCount: 0,
92 })
93 }
94
95 /**
96 * Invalidate entries matching a pattern

Callers 15

buildMonarchRulesFunction · 0.45
registerMonacoThemeFunction · 0.45
terminal-tabs.tsxFile · 0.45
AgentsSubChatsSidebarFunction · 0.45
handleCreateNewFunction · 0.45
agents-sidebar.tsxFile · 0.45
AgentsSidebarFunction · 0.45
groupFilesByFolderFunction · 0.45
registerMethod · 0.45
getByTriggerMethod · 0.45
getCategoriesMethod · 0.45
getServersFromContextFunction · 0.45

Calls 1

deleteMethod · 0.45

Tested by

no test coverage detected