public class EmptyCacheMap<K,V> extends AbstractMap<K,V> implements Cache<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>DEFAULT_LIFETIME, DEFAULT_MAX_SIZE| Constructor and Description |
|---|
EmptyCacheMap() |
| Modifier and Type | Method and Description |
|---|---|
Set<Map.Entry<K,V>> |
entrySet() |
int |
getLifetime()
Returns the minimal lifetime, unit=milliseconds.
|
int |
getMaxSize()
Returns the maximal allowed size.
|
V |
put(K key,
V value)
Stores an object to the cache.
|
void |
setLifetime(int lifetime)
Sets the minimal lifetime.
|
void |
setMaxSize(int maxsize)
Sets the maximal allowed size.
|
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitclear, containsKey, get, removecompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic V put(K key, V value)
Cachepublic int getLifetime()
CachegetLifetime in interface Cache<K,V>Cache.getMaxSize()public void setLifetime(int lifetime)
CacheCache.DEFAULT_LIFETIME.setLifetime in interface Cache<K,V>lifetime - the lifetime, unit=milliseconds;
if non-positive, they will be removed immediately.Cache.getLifetime()public int getMaxSize()
CacheCache.DEFAULT_MAX_SIZE.
An mapping won't be removed by GC unless the minimal lifetime
or the maximal allowed size exceeds.getMaxSize in interface Cache<K,V>Cache.getLifetime()public void setMaxSize(int maxsize)
CachesetMaxSize in interface Cache<K,V>Cache.getMaxSize()Copyright © 2021. All rights reserved.