public interface Cache<K,V>
| 限定符和类型 | 方法和说明 |
|---|---|
void |
cancelRefreshAll() |
void |
clean() |
void |
evictExpired() |
V |
get(K key)
get by key
|
V |
get(K key,
Supplier<K,V> loader) |
Map<K,V> |
getAll(Iterable<K> keys)
multiple get
|
Map<K,V> |
getAllIfPresent(Iterable<K> keys)
multiple get
|
V |
getIfPresent(K key) |
Set<K> |
keys() |
void |
refresh(K key) |
void |
refreshAllAsync(int delay,
boolean fixed)
刷新所有
|
List<V> |
remove(Collection<K> keys) |
V |
remove(K key) |
void |
set(K key,
V value)
set a key-value to cache, with out expire time never
|
void |
set(K key,
V value,
long expireTime)
set a key-value to cache, with the specified expire time
|
void |
set(K key,
V value,
long ttl,
TimeUnit timeUnit)
set a key-value to cache, with the specified expire time
|
int |
size() |
Map<K,V> |
toMap() |
void set(@NonNull K key, @Nullable V value)
key - the keyvalue - the valuevoid set(@NonNull K key, @Nullable V value, long expireTime)
key - the keyvalue - the valueexpireTime - the expire timevoid set(@NonNull K key, @Nullable V value, long ttl, TimeUnit timeUnit)
key - the keyvalue - the valuettl - the time-to-live time, the live timeMap<K,V> getAll(@NonNull Iterable<K> keys)
keys - get the specified keysMap<K,V> getAllIfPresent(@NonNull Iterable<K> keys)
keys - get the specified keysList<V> remove(Collection<K> keys)
void refreshAllAsync(int delay,
boolean fixed)
fixed - 是否为固定频率的(周期)刷新,若为true,则delay 必须 >0delay - 延迟时间,delay <=0 代表立即刷新, 大于0则代表延迟刷新void cancelRefreshAll()
void evictExpired()
void clean()
int size()
Copyright © 2021. All rights reserved.