Package org.zkoss.util
Class EmptyCacheMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.zkoss.util.EmptyCacheMap<K,V>
-
-
Field Summary
-
Fields inherited from interface org.zkoss.util.Cache
DEFAULT_LIFETIME, DEFAULT_MAX_SIZE
-
-
Constructor Summary
Constructors Constructor Description EmptyCacheMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.util.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.-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.zkoss.util.Cache
clear, containsKey, get, remove
-
-
-
-
Method Detail
-
put
public V put(K key, V value)
Description copied from interface:Cache
Stores an object to the cache.
-
getLifetime
public int getLifetime()
Description copied from interface:Cache
Returns the minimal lifetime, unit=milliseconds. An mapping won't be removed by GC unless the minimal lifetime or the maximal allowed size exceeds.- Specified by:
getLifetime
in interfaceCache<K,V>
- See Also:
Cache.getMaxSize()
-
setLifetime
public void setLifetime(int lifetime)
Description copied from interface:Cache
Sets the minimal lifetime. Default:Cache.DEFAULT_LIFETIME
.- Specified by:
setLifetime
in interfaceCache<K,V>
- Parameters:
lifetime
- the lifetime, unit=milliseconds; if non-positive, they will be removed immediately.- See Also:
Cache.getLifetime()
-
getMaxSize
public int getMaxSize()
Description copied from interface:Cache
Returns the maximal allowed size. Default:Cache.DEFAULT_MAX_SIZE
. An mapping won't be removed by GC unless the minimal lifetime or the maximal allowed size exceeds.- Specified by:
getMaxSize
in interfaceCache<K,V>
- See Also:
Cache.getLifetime()
-
setMaxSize
public void setMaxSize(int maxsize)
Description copied from interface:Cache
Sets the maximal allowed size.- Specified by:
setMaxSize
in interfaceCache<K,V>
- See Also:
Cache.getMaxSize()
-
-