MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / set

Method set

backend/api/src/postgres-proxy/utils/cache.util.ts:92–107  ·  view source on GitHub ↗

* Sets a value in cache

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

Source from the content-addressed store, hash-verified

90 * Sets a value in cache
91 */
92 set(key: string, value: T, customTTL?: number): void {
93 // Check size limit and evict if necessary
94 if (this.cache.size >= this.options.maxSize) {
95 this.evictLeastRecentlyUsed();
96 }
97
98 const now = Date.now();
99 const entry: CacheEntry<T> = {
100 data: value,
101 timestamp: now,
102 lastAccessed: now,
103 accessCount: 1,
104 };
105
106 this.cache.set(key, entry);
107 }
108
109 /**
110 * Checks if a key exists in cache (without updating access stats)

Callers 15

CacheableFunction · 0.95
onRequestFunction · 0.80
AISettingsFunction · 0.80
handleKeyChangeFunction · 0.80
handleUpdateKeyFunction · 0.80
handleCancelUpdateFunction · 0.80
handleInstallPackageFunction · 0.80
handlePullModelFunction · 0.80
ApiKeyModalFunction · 0.80
handleKeyChangeFunction · 0.80
handleDownloadModelFunction · 0.80

Calls 1

Tested by

no test coverage detected