public class MemoryCacheStrategy<K,V> extends Object implements CacheStrategy<K,V>
Map to store values
in memory.
Memory caches are thread-safe in all operations.
| Modifier and Type | Field and Description |
|---|---|
static String |
ALIAS
Aliased used by provider for this implementation
|
| Constructor and Description |
|---|
MemoryCacheStrategy()
Default constructor.
|
MemoryCacheStrategy(Map<K,V> cacheHolder)
Constructs a new
MemoryCacheStrategy and sets the Map that will be
used as memory cache. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all cache contents.
|
void |
destroy()
Perform the clean up.
|
V |
get(K key)
Restore a value from the cache.
|
void |
put(K key,
V value)
Put a value in the cache using a key.
|
public static final String ALIAS
public MemoryCacheStrategy()
HashMap as memory cache.public MemoryCacheStrategy(Map<K,V> cacheHolder)
MemoryCacheStrategy and sets the Map that will be
used as memory cache.cacheHolder - Map to use as memory cache. It cannot be null.public V get(K key)
get in interface CacheStrategy<K,V>key - Objectpublic void put(K key, V value)
put in interface CacheStrategy<K,V>key - Object.value - Object.public void clear()
clear in interface CacheStrategy<K,V>public void destroy()
destroy in interface CacheStrategy<K,V>Copyright © 2008-2016. All Rights Reserved.