K - the key typeV - the value typepublic class MemoryCache<K,V> extends Object implements Cache<K,V>, CacheProvider<K,V>
| Constructor and Description |
|---|
MemoryCache()
Instantiates a new MemoryCache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the cache.
|
void |
clearByKey(K key)
Removes cache entry by key.
|
void |
clearByValue(V value)
Removes cache entry by value.
|
V |
get(K key)
Gets the object stored in the cache by key.
|
Cache<K,V> |
getCache()
Gets the cache.
|
Map<K,V> |
getStorage()
Gets the storage.
|
protected void |
init()
Instantiates storage.
|
V |
put(K key,
V value)
Puts the object into the cache.
|
int |
size()
Returns size of the cache.
|
public void clear()
Cachepublic void clearByKey(K key)
CacheclearByKey in interface Cache<K,V>key - the keypublic void clearByValue(V value)
CacheclearByValue in interface Cache<K,V>value - the valuepublic V get(K key)
Cachepublic Cache<K,V> getCache()
CacheProvidergetCache in interface CacheProvider<K,V>protected void init()
public V put(K key, V value)
CacheCopyright © 2010-2020 Toolsverse. All Rights Reserved.