Package org.jppf.caching
Class AbstractJPPFMapCache<K,V>
java.lang.Object
org.jppf.caching.AbstractJPPFMapCache<K,V>
- Type Parameters:
K- the type of keys.V- the type of values.
- All Implemented Interfaces:
JPPFMapCache<K,V>
- Direct Known Subclasses:
JPPFHashMapCache,JPPFLRUMapCache
A map cache with a LRU eviction policy.
- Author:
- Laurent Cohen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the cache.Create the backing map.Get an element in the cache.booleanDetermine whether an entry with the specified key is in the cache.voidPut an element in the cache.Remove an element from the cache.
-
Field Details
-
map
The backing map for this cache.
-
-
Constructor Details
-
AbstractJPPFMapCache
public AbstractJPPFMapCache()
-
-
Method Details
-
createMap
Create the backing map.- Returns:
- a map for this cache.
-
put
Description copied from interface:JPPFMapCachePut an element in the cache.- Specified by:
putin interfaceJPPFMapCache<K,V> - Parameters:
key- the element's key for retrival.value- the element's value.
-
get
Description copied from interface:JPPFMapCacheGet an element in the cache.- Specified by:
getin interfaceJPPFMapCache<K,V> - Parameters:
key- the element's key.- Returns:
- the value of the element, or
nullif the element is not in the cache.
-
remove
Description copied from interface:JPPFMapCacheRemove an element from the cache.- Specified by:
removein interfaceJPPFMapCache<K,V> - Parameters:
key- the element's key.- Returns:
- the value of the removed element, or
nullif the element is not in the cache.
-
clear
public void clear()Description copied from interface:JPPFMapCacheClear the cache. This removes all elements from the cache.- Specified by:
clearin interfaceJPPFMapCache<K,V>
-
has
Description copied from interface:JPPFMapCacheDetermine whether an entry with the specified key is in the cache.- Specified by:
hasin interfaceJPPFMapCache<K,V> - Parameters:
key- the key to look up.- Returns:
trueif the key is in the cache,falseotherwise.
-