Class LruCache<K extends Serializable,V extends Serializable>

java.lang.Object
org.omnifaces.util.cache.LruCache<K,V>
Type Parameters:
K - The generic map key type.
V - The generic map value type.
All Implemented Interfaces:
Serializable, ConcurrentMap<K,V>, Map<K,V>

public class LruCache<K extends Serializable,V extends Serializable> extends Object implements ConcurrentMap<K,V>, Serializable
Minimal implementation of thread safe LRU cache with support for eviction listener. Inspired by ConcurrentLinkedHashMap.

The compute methods hold the lock while the function runs, so the function must be short and must not access this cache, else it will block every other caller or deadlock. The eviction listener runs after the lock is released.

Since:
4.4
Author:
Bauke Scholtz
See Also: