Package ch.qos.logback.classic.turbo
Class LRUMessageCache
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<java.lang.String,java.lang.Integer>
-
- ch.qos.logback.classic.turbo.LRUMessageCache
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Integer>
class LRUMessageCache extends java.util.LinkedHashMap<java.lang.String,java.lang.Integer>Clients of this class should only use thegetMessageCountAndThenIncrement(java.lang.String)method. Other methods inherited via LinkedHashMap are not thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intcacheSizeprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description LRUMessageCache(int cacheSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()(package private) intgetMessageCountAndThenIncrement(java.lang.String msg)protected booleanremoveEldestEntry(java.util.Map.Entry eldest)-
Methods inherited from class java.util.LinkedHashMap
containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
cacheSize
final int cacheSize
-
-
Method Detail
-
getMessageCountAndThenIncrement
int getMessageCountAndThenIncrement(java.lang.String msg)
-
removeEldestEntry
protected boolean removeEldestEntry(java.util.Map.Entry eldest)
- Overrides:
removeEldestEntryin classjava.util.LinkedHashMap<java.lang.String,java.lang.Integer>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Map<java.lang.String,java.lang.Integer>- Overrides:
clearin classjava.util.LinkedHashMap<java.lang.String,java.lang.Integer>
-
-