Package com.alibaba.druid.util
Class ConcurrentLruCache<K,V>
java.lang.Object
com.alibaba.druid.util.ConcurrentLruCache<K,V>
Simple LRU (Least Recently Used) cache, bounded by a specified cache capacity.
This is a simplified, opinionated implementation of an LRU cache
It is inspired from
ConcurrentLruCache.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ConcurrentLruCache
public ConcurrentLruCache(int capacity)
-
-
Method Details
-
get
-
computeIfAbsent
-
forEach
-
keys
-
size
public int size() -
clear
public void clear() -
contains
Determine whether the given key is present in this cache.- Parameters:
key- the key to check for- Returns:
trueif the key is present,falseif there was no matching key
-
remove
Immediately remove the given key and any associated value.- Parameters:
key- the key to evict the entry for- Returns:
trueif the key was present before,falseif there was no matching key
-