public class TimedCacheImpl<T> extends Object implements TimedCache<T>
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
close() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,T>> |
entrySet() |
T |
get(Object key) |
T |
getOrDefault(Object key,
T defaultValue) |
Map<String,TimedCacheValue<T>> |
getStore()
获取存储容器
|
boolean |
isEmpty() |
Set<String> |
keySet() |
T |
put(String key,
T value) |
T |
put(String key,
T value,
long expireAfter)
添加并指定过期时间
|
void |
putAll(Map<? extends String,? extends T> map) |
T |
putIfAbsent(String key,
T value) |
T |
putIfAbsent(String key,
T value,
long expireAfter)
添加并指定过期时间
|
T |
remove(Object key) |
int |
size() |
String |
toString() |
Collection<T> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, hashCode, merge, remove, replace, replace, replaceAll
public T put(String key, T value, long expireAfter)
TimedCache
put
in interface TimedCache<T>
key
- keyvalue
- valueexpireAfter
- 自定义过期时间public T putIfAbsent(String key, T value)
putIfAbsent
in interface Map<String,T>
public T putIfAbsent(String key, T value, long expireAfter)
TimedCache
putIfAbsent
in interface TimedCache<T>
key
- keyvalue
- valueexpireAfter
- 自定义过期时间public T getOrDefault(Object key, T defaultValue)
getOrDefault
in interface Map<String,T>
public boolean containsKey(Object key)
containsKey
in interface Map<String,T>
public boolean containsValue(Object value)
containsValue
in interface Map<String,T>
public Map<String,TimedCacheValue<T>> getStore()
TimedCache
getStore
in interface TimedCache<T>
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2025. All rights reserved.