MCPcopy Index your code
hub / github.com/21st-dev/1code / evictIfNeeded

Method evictIfNeeded

src/main/lib/git/cache/git-cache.ts:146–162  ·  view source on GitHub ↗
(incomingSizeBytes: number)

Source from the content-addressed store, hash-verified

144 }
145
146 private evictIfNeeded(incomingSizeBytes: number): void {
147 // Evict by entry count
148 while (this.cache.size >= this.config.maxEntries) {
149 this.evictLRU();
150 }
151
152 // Evict by size if configured
153 if (this.config.maxSizeBytes) {
154 while (
155 this.currentSizeBytes + incomingSizeBytes >
156 this.config.maxSizeBytes &&
157 this.cache.size > 0
158 ) {
159 this.evictLRU();
160 }
161 }
162 }
163
164 private evictLRU(): void {
165 let lruKey: string | null = null;

Callers 1

setMethod · 0.95

Calls 1

evictLRUMethod · 0.95

Tested by

no test coverage detected