ecache library

Classes

Cache<K, V>
The interace for the cache
CacheEntry<K, V>
ExpirationCache<K, V>
A cache which evicts entries after a certain amount of time
ExpirationCacheEntry<K, V>
//////////////////////////////////////////////////////////////////////////
LfuCache<K, V>
Least frequently used cache. Items which are not used often gets evicted first
LfuCacheEntry<K, V>
//////////////////////////////////////////////////////////////////////////
LruCache<K, V>
Least recently used cache. Items which are not read for the longest period gets evicted first
LruCacheEntry<K, V>
//////////////////////////////////////////////////////////////////////////
SimpleCache<K, V>
SimpleCache is a basic cache implementation without any particular logic than appending keys in the storage, and remove first inserted keys when storage is full
SimpleStorage<K, V>
A simple storage class which is backed by a LinkedHashMap internally
StatisticsStorage<K, V>
Same as SimpleStorage but collects a few statistical data. The statistics can be retrieved by calling toString
Storage<K, V>
The abstract interface for a storage class
WeakReferenceStorage<K, V>
A Storage with a fixed number of storable elements and a weak reference to elements which are specified to be evicted. This way the cache can grow until the garbage collector decides to remove the entries.

Typedefs

OnEvict<K, V> = void Function(K k, V v)
This method will be called if a value is removed from the storage. It can be used to dispose items