MCPcopy Create free account
hub / github.com/echoVic/blade-code / cleanExpired

Method cleanExpired

src/context/storage/CacheStore.ts:217–228  ·  view source on GitHub ↗

* 清理过期项

()

Source from the content-addressed store, hash-verified

215 * 清理过期项
216 */
217 private cleanExpired(): void {
218 const now = Date.now();
219 const expiredKeys: string[] = [];
220
221 for (const [key, item] of Array.from(this.cache.entries())) {
222 if (now - item.timestamp > item.ttl) {
223 expiredKeys.push(key);
224 }
225 }
226
227 expiredKeys.forEach(key => this.cache.delete(key));
228 }
229
230 /**
231 * 驱逐最不常用的项

Callers 2

sizeMethod · 0.95
getStatsMethod · 0.95

Calls 1

deleteMethod · 0.80

Tested by

no test coverage detected