public class TimedCache extends Object implements Closeable
Constructor and Description |
---|
TimedCache(int expiredDelay,
int checkDelay,
BiConsumer<String,Object> expiredListener) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
清空
|
void |
close() |
boolean |
containsKey(String key)
检测是否有此缓存
|
<V> V |
get(String key)
获取值
|
<V> V |
getOrDefault(String key,
V def)
获取值
|
ConcurrentHashMap<String,cn.orionsec.kit.lang.define.cache.TimedCache.Value> |
getStore() |
<V> V |
put(String key,
Function<String,V> valueSupplier)
添加
|
void |
put(String key,
Object value)
添加
|
<V> V |
put(String key,
Supplier<V> valueSupplier)
添加
|
void |
putAll(Map<String,Object> map)
添加
|
String |
toString() |
public TimedCache(int expiredDelay, int checkDelay, BiConsumer<String,Object> expiredListener)
public <V> V put(String key, Supplier<V> valueSupplier)
V
- Vkey
- keyvalueSupplier
- valueSupplierpublic <V> V put(String key, Function<String,V> valueSupplier)
V
- Vkey
- keyvalueSupplier
- valueSupplierpublic <V> V get(String key)
V
- Vkey
- keypublic <V> V getOrDefault(String key, V def)
V
- Vkey
- keydef
- defpublic boolean containsKey(String key)
key
- keypublic void clear()
public ConcurrentHashMap<String,cn.orionsec.kit.lang.define.cache.TimedCache.Value> getStore()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2024. All rights reserved.