Class CacheMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
tech.riemann.nif.utils.CacheMap<K,V>
- Type Parameters:
K- 键类型V- 值类型
- All Implemented Interfaces:
Map<K,V>
缓存映射实现类,支持自动清除过期条目 这是一个基于时间的缓存容器,会自动清理超过指定超时时间的条目
- Author:
- Kerbores(kerbores@riemann.tech)
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractMap
clear, clone, containsValue, isEmpty, keySet, putAll, toString, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
CacheMap
public CacheMap(long timeout) 构造函数,创建具有指定超时时间的缓存映射- Parameters:
timeout- 条目在缓存中的最大存活时间(毫秒)
-
-
Method Details
-
getDefault
-
shutdown
public void shutdown()关闭缓存清理线程 -
entrySet
-
get
-
put
-
remove
-
equals
-
hashCode
-
size
-
containsKey
检查缓存是否包含指定的键- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V> - Parameters:
key- 待检查的键- Returns:
- 如果缓存中包含该键则返回true,否则返回false
-