MCPcopy
hub / github.com/wavetermdev/waveterm / tryEvictEntry

Function tryEvictEntry

emain/emain-tabview.ts:253–276  ·  view source on GitHub ↗
(waveTabId: string)

Source from the content-addressed store, hash-verified

251}
252
253function tryEvictEntry(waveTabId: string): boolean {
254 const tabView = wcvCache.get(waveTabId);
255 if (!tabView) {
256 return false;
257 }
258 if (tabView.isActiveTab) {
259 return false;
260 }
261 const lastUsedDiff = Date.now() - tabView.lastUsedTs;
262 if (lastUsedDiff < 1000) {
263 return false;
264 }
265 const ww = getWaveWindowById(tabView.waveWindowId);
266 if (!ww) {
267 // this shouldn't happen, but if it does, just destroy the tabview
268 console.log("[error] WaveWindow not found for WaveTabView", tabView.waveTabId);
269 tabView.destroy();
270 return true;
271 } else {
272 // will trigger a destroy on the tabview
273 ww.removeTabView(tabView.waveTabId, false);
274 return true;
275 }
276}
277
278function checkAndEvictCache(): void {
279 if (wcvCache.size <= MaxCacheSize) {

Callers 2

checkAndEvictCacheFunction · 0.85
clearTabCacheFunction · 0.85

Calls 4

getWaveWindowByIdFunction · 0.90
getMethod · 0.80
removeTabViewMethod · 0.80
destroyMethod · 0.45

Tested by

no test coverage detected