Class DefaultCache<KeyType,ValueType>
- java.lang.Object
-
- com.github.dozermapper.core.cache.DefaultCache<KeyType,ValueType>
-
- Type Parameters:
KeyType- type of key being storedValueType- java of value being stored
- All Implemented Interfaces:
Cache<KeyType,ValueType>
public class DefaultCache<KeyType,ValueType> extends Object implements Cache<KeyType,ValueType>
Default cache manager implementation backed byDefaultCache.LRUMap
-
-
Constructor Summary
Constructors Constructor Description DefaultCache(String name, int maximumSize)Default cache manager implementation backed byDefaultCache.LRUMap
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all of the mappings from this map.booleancontainsKey(KeyType key)Returns true if this map contains a mapping for the specified key.ValueTypeget(KeyType key)Returns the value to which the specified key is mapped, ornullif this map contains no mapping for the key.intgetMaxSize()Returns the maximum number of entries which the cache can holdStringgetName()Returns the name of the overall cache storelonggetSize()Returns the number of key-value mappings in this map.voidput(KeyType key, ValueType value)Associates the specified value with the specified key in this map.StringtoString()
-
-
-
Constructor Detail
-
DefaultCache
public DefaultCache(String name, int maximumSize)
Default cache manager implementation backed byDefaultCache.LRUMap- Parameters:
name- unique cache namemaximumSize- maximum cache size
-
-
Method Detail
-
clear
public void clear()
Removes all of the mappings from this map. The map will be empty after this call returns.
-
put
public void put(KeyType key, ValueType value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
-
get
public ValueType get(KeyType key)
Returns the value to which the specified key is mapped, ornullif this map contains no mapping for the key.
-
getName
public String getName()
Returns the name of the overall cache store
-
getSize
public long getSize()
Returns the number of key-value mappings in this map.
-
getMaxSize
public int getMaxSize()
Returns the maximum number of entries which the cache can hold- Specified by:
getMaxSizein interfaceCache<KeyType,ValueType>- Returns:
- maximum number of entries which the cache can hold
-
containsKey
public boolean containsKey(KeyType key)
Returns true if this map contains a mapping for the specified key.- Specified by:
containsKeyin interfaceCache<KeyType,ValueType>- Parameters:
key- The key whose presence in this map is to be tested- Returns:
- true if this map contains a mapping for the specified key.
-
-