| 限定符和类型 | 字段和说明 |
|---|---|
protected Map<K,com.droxy.cache.AbstractCacheMap.CacheObject<K,V>> |
cacheMap |
protected int |
cacheSize |
protected long |
defaultExpire |
protected boolean |
existCustomExpire |
| 构造器和说明 |
|---|
AbstractCacheMap(int cacheSize,
long defaultExpire) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
清除所有缓存对象
|
int |
eliminate()
淘汰对象
|
protected abstract int |
eliminateCache()
淘汰对象具体实现
|
V |
get(K key)
查找缓存对象
|
int |
getCacheSize()
返回缓存大小
|
long |
getDefaultExpire()
返回默认存活时间
|
boolean |
isEmpty()
缓存中是否为空
|
boolean |
isFull()
缓存是否已经满
|
protected boolean |
isNeedClearExpiredObject() |
void |
put(K key,
V value)
向缓存添加value对象,其在缓存中生存时间为默认值
|
void |
put(K key,
V value,
long expire)
向缓存添加value对象,并指定存活时间
|
void |
remove(K key)
删除缓存对象
|
int |
size()
返回当前缓存的大小
|
protected int cacheSize
protected boolean existCustomExpire
protected long defaultExpire
public int getCacheSize()
CachegetCacheSize 在接口中 Cache<K,V>public long getDefaultExpire()
CachegetDefaultExpire 在接口中 Cache<K,V>protected boolean isNeedClearExpiredObject()
public final int eliminate()
Cacheprotected abstract int eliminateCache()
Copyright © 2021. All rights reserved.