Class EmptyCacheMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
org.zkoss.util.EmptyCacheMap<K,V>
All Implemented Interfaces:
Map<K,V>, Cache<K,V>

public class EmptyCacheMap<K,V> extends AbstractMap<K,V> implements Cache<K,V>
An empty cache map.
Since:
9.6.0
Author:
jameschu
  • Constructor Details

    • EmptyCacheMap

      public EmptyCacheMap()
  • Method Details

    • put

      public V put(K key, V value)
      Description copied from interface: Cache
      Stores an object to the cache.
      Specified by:
      put in interface Cache<K,V>
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class AbstractMap<K,V>
      Returns:
      the previous value of the same, or null if no such value
    • 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 interface Cache<K,V>
      See Also:
    • setLifetime

      public void setLifetime(int lifetime)
      Description copied from interface: Cache
      Sets the minimal lifetime. Default: Cache.DEFAULT_LIFETIME.
      Specified by:
      setLifetime in interface Cache<K,V>
      Parameters:
      lifetime - the lifetime, unit=milliseconds; if non-positive, they will be removed immediately.
      See Also:
    • 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 interface Cache<K,V>
      See Also:
    • setMaxSize

      public void setMaxSize(int maxsize)
      Description copied from interface: Cache
      Sets the maximal allowed size.
      Specified by:
      setMaxSize in interface Cache<K,V>
      See Also:
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>
      Specified by:
      entrySet in class AbstractMap<K,V>