MCPcopy Create free account
hub / github.com/Noumena-Network/code / evictOldestIfAtCap

Function evictOldestIfAtCap

src/utils/imageStore.ts:115–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113}
114
115function evictOldestIfAtCap(): void {
116 while (storedImagePaths.size >= MAX_STORED_IMAGE_PATHS) {
117 const oldest = storedImagePaths.keys().next().value
118 if (oldest !== undefined) {
119 storedImagePaths.delete(oldest)
120 } else {
121 break
122 }
123 }
124}
125
126/**
127 * Clean up old image cache directories from previous sessions.

Callers 2

cacheImagePathFunction · 0.85
storeImageFunction · 0.85

Calls 3

keysMethod · 0.80
deleteMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected