Class CacheMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
tech.riemann.etp.CacheMap<K,V>
Type Parameters:
K -
V -
All Implemented Interfaces:
Map<K,V>

public class CacheMap<K,V> extends AbstractMap<K,V>
Author:
Kerbores(kerbores@riemann.tech)
  • Constructor Details

    • CacheMap

      public CacheMap(long timeout)
  • Method Details

    • getDefault

      public static CacheMap<Object,Object> getDefault()
    • entrySet

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

      public V get(Object key)
      根据给定的键从缓存中获取值
      Specified by:
      get in interface Map<K,V>
      Overrides:
      get in class AbstractMap<K,V>
      Parameters:
      key - 要获取值的键
      Returns:
      与指定键关联的值如果键不存在,则返回null
    • put

      public V put(K key, V value)
      向缓存中添加一个键值对。
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class AbstractMap<K,V>
      Parameters:
      key - 缓存键,用于标识缓存中的项。
      value - 缓存值,要添加到缓存中的数据。
      Returns:
      返回被替换的旧值,如果之前不存在则返回null。
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<K,V>
      Overrides:
      equals in class AbstractMap<K,V>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class AbstractMap<K,V>