Trim LRU maps after dropping entries
This commit is contained in:
parent
d8e937720f
commit
dee2627df9
|
|
@ -28,6 +28,7 @@ public class LRUMap<K, V> extends Object2ObjectLinkedOpenHashMap<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropEntriesToMeetSize(int size) {
|
public void dropEntriesToMeetSize(int size) {
|
||||||
|
int expectedQuota = size;
|
||||||
// Increase allowed size quota to include permanent entries
|
// Increase allowed size quota to include permanent entries
|
||||||
size += permanentEntries.size();
|
size += permanentEntries.size();
|
||||||
int prevSize = size();
|
int prevSize = size();
|
||||||
|
|
@ -39,6 +40,7 @@ public class LRUMap<K, V> extends Object2ObjectLinkedOpenHashMap<K, V> {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
trim(size() + expectedQuota);
|
||||||
if(ModernFixPlatformHooks.INSTANCE.isDevEnv()) {
|
if(ModernFixPlatformHooks.INSTANCE.isDevEnv()) {
|
||||||
ModernFix.LOGGER.warn("Trimmed map from {} to {} entries", prevSize, size);
|
ModernFix.LOGGER.warn("Trimmed map from {} to {} entries", prevSize, size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user