MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / checkAndEvictCache

Function checkAndEvictCache

emain/emain-tabview.ts:278–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

276}
277
278function checkAndEvictCache(): void {
279 if (wcvCache.size <= MaxCacheSize) {
280 return;
281 }
282 const sorted = Array.from(wcvCache.values()).sort((a, b) => {
283 // Prioritize entries which are active
284 if (a.isActiveTab && !b.isActiveTab) {
285 return -1;
286 }
287 // Otherwise, sort by lastUsedTs
288 return a.lastUsedTs - b.lastUsedTs;
289 });
290 for (let i = 0; i < sorted.length - MaxCacheSize; i++) {
291 tryEvictEntry(sorted[i].waveTabId);
292 }
293}
294
295export function clearTabCache() {
296 const wcVals = Array.from(wcvCache.values());

Callers 1

setWaveTabViewFunction · 0.85

Calls 1

tryEvictEntryFunction · 0.85

Tested by

no test coverage detected