MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / trimAssetCache

Function trimAssetCache

eat/eat.ts:14–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12const assetBufferCache = new Map<string, Buffer>();
13
14function trimAssetCache(): void {
15 if (assetBufferCache.size <= MAX_ASSET_CACHE_SIZE) return;
16 const excess = assetBufferCache.size - MAX_ASSET_CACHE_SIZE;
17 let count = 0;
18 for (const key of Array.from(assetBufferCache.keys())) {
19 if (count >= excess) break;
20 assetBufferCache.delete(key);
21 count++;
22 }
23}
24
25interface RoleConfig {
26 x: number;

Callers 1

getAssetBufferFunction · 0.85

Calls 1

deleteMethod · 0.45

Tested by

no test coverage detected