| Modifier and Type | Field and Description |
|---|---|
static boolean |
schedulePrune
是否开启定时
clear() ()}的任务 |
static long |
timeout
默认缓存过期时间:3分钟
鉴于授权过程中,根据个人的操作习惯,或者授权平台的不同(google等),每个授权流程的耗时也有差异,不过单个授权流程一般不会太长
本缓存工具默认的过期时间设置为3分钟,即程序默认认为3分钟内的授权有效,超过3分钟则默认失效,失效后删除
|
| Constructor and Description |
|---|
MemoryCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
清理过期的缓存
|
Map<String,Object> |
read(Collection<String> keys)
从缓存中获得一组对象信息
|
Object |
read(String key)
获取缓存
|
void |
remove(String... keys)
清理过期的缓存
|
void |
schedulePrune(long delay)
定时清理
|
void |
write(Map<String,Object> keyValueMap,
long expire)
设置缓存
|
void |
write(String key,
Object value,
long expire)
设置缓存
|
public static long timeout
public static boolean schedulePrune
clear() ()}的任务public void write(Map<String,Object> keyValueMap, long expire)
write in interface CacheXkeyValueMap - 缓存内容expire - 指定缓存过期时间(毫秒)CacheX.write(Map, long)public void write(String key, Object value, long expire)
write in interface CacheXkey - 缓存KEYvalue - 缓存内容expire - 指定缓存过期时间(毫秒)CacheX.write(String, Object, long)public Object read(String key)
read in interface CacheXkey - 缓存KEYCacheX.read(String)public Map<String,Object> read(Collection<String> keys)
CacheXpublic void remove(String... keys)
public void schedulePrune(long delay)
delay - 间隔时长,单位毫秒Copyright © 2020. All rights reserved.