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()
Cache
public void clearByKey(K key)
Cache
clearByKey
in interface Cache<K,V>
key
- the keypublic void clearByValue(V value)
Cache
clearByValue
in interface Cache<K,V>
value
- the valuepublic V get(K key)
Cache
public Cache<K,V> getCache()
CacheProvider
getCache
in interface CacheProvider<K,V>
protected void init()
public V put(K key, V value)
Cache
Copyright © 2010-2020 Toolsverse. All Rights Reserved.