com.github.shyiko.mysql.binlog.event.LRUCache Maven / Gradle / Ivy
package com.github.shyiko.mysql.binlog.event;
import java.util.LinkedHashMap;
import java.util.Map;
public class LRUCache extends LinkedHashMap {
private int maxSize;
// and other constructors for load factor and hashtable capacity
public LRUCache(int initialCapacity, float loadFactor, int maxSize) {
super(initialCapacity, loadFactor, true);
this.maxSize = maxSize;
}
@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > maxSize;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy