K
- The key type for this cacheV
- The value type for this cachepublic abstract class LRUCache<K,V> extends Object
Constructor and Description |
---|
LRUCache() |
Modifier and Type | Method and Description |
---|---|
static <K,V> LRUCache<K,V> |
createCache(int maxCacheSize)
Creates a cache with the given maximum cache size
|
abstract V |
get(K key)
Returns the value associated with the given key.
|
abstract int |
getMaxCacheSize()
Returns the maximum number of entries that will be stored in this cache
|
abstract CacheEntry |
put(K key,
V value)
Adds the given key and value pair into the cache
|
abstract void |
releaseCache()
Clears all entries in the cache, for use when a known event makes the cache incorrect
|
abstract void |
releaseMatching(CacheKeyFilter<K> filter)
This method will remove all cache entries for which this filter
matches
|
public static <K,V> LRUCache<K,V> createCache(int maxCacheSize)
maxCacheSize
- The maximum number of entries in the cache, must be greater than 2public abstract V get(K key)
key
- Must be a non-null key, appropriate for use as the key to a hash mappublic abstract CacheEntry put(K key, V value)
key
- Must be a non-null key, appropriate for use as the key to a hash mapvalue
- Must be a non-null valuepublic abstract void releaseCache()
public abstract int getMaxCacheSize()
public abstract void releaseMatching(CacheKeyFilter<K> filter)
filter
- Entries in the cache that match this filter will
be removed from the cache. If filter is null nothing
will be removed from the cacheCopyright © 2009-2017, Oracle and/or its affiliates. All Rights Reserved.