Cache<K, V> abstract class
The Cache interface.
abstract class Cache<K, V> {
/**
* Returns the value for `key` from the cache. If `key` is not in the cache,
* returns `null`.
*/
V get(K key);
/**
* Inserts/Updates the `key` in the cache with `value` and returns the value.
*/
V put(K key, V value);
/**
* Removes `key` from the cache. If `key` isn't present in the cache, does
* nothing.
*/
V remove(K key);
/**
* Removes all entries from the cache.
*/
void removeAll();
int get capacity;
int get size;
CacheStats stats();
}
Subclasses
LruCache<K, V>, UnboundedCache<K, V>
Methods
abstract V get(K key) #
Returns the value for key from the cache. If key is not in the cache,
returns null.
abstract V put(K key, V value) #
Inserts/Updates the key in the cache with value and returns the value.
abstract V remove(K key) #
Removes key from the cache. If key isn't present in the cache, does
nothing.
abstract void removeAll() #
Removes all entries from the cache.