public class MapCache extends CacheAdapter
ConcurrentHashMap
.
This is the default Cache Extension used if your Application do not declare any Cache Plugin.
Expiration is applied on access only. This may not suit your usage pattern.
No metrics gathered.
See the the EhCache, Memcache and Redis based Cache Plugins for alternatives.
CacheAdapter.CacheEvent
Modifier and Type | Field and Description |
---|---|
protected ConcurrentMap<String,Couple<Long,Object>> |
map |
Constructor and Description |
---|
MapCache() |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
doGet(String key)
Concrete GET.
|
protected void |
doRemove(String key)
Concrete REMOVE.
|
protected <T> void |
doSet(int ttlSeconds, String key, T value)
Concrete SET.
|
get, getOptional, getOrSetDefault, getOrSetDefault, getOrSetDefault, getOrSetDefault, has, remove, set, set
protected final ConcurrentMap<String,Couple<Long,Object>> map
protected <T> T doGet(String key)
CacheAdapter
doGet
in class
CacheAdapter
T
- Parameterized type of value
key
- Cache Key
protected <T> void doSet(int ttlSeconds, String key, T value)
CacheAdapter
doSet
in class
CacheAdapter
T
- Parameterized type of value
ttlSeconds
- TTL in seconds
key
- Cache Key
value
- Value
protected void doRemove(String key)
CacheAdapter
doRemove
in class
CacheAdapter
key
- Cache Key