| 构造器和说明 |
|---|
NoCache() |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
capacity() |
void |
clear()
清空缓存
|
V |
get(K key)
从缓存中获得对象,当对象不在缓存中或已经过期返回
null |
boolean |
isEmpty() |
boolean |
isFull() |
Iterator<V> |
iterator() |
int |
prune()
从缓存中清理过期对象,清理策略取决于具体实现
|
void |
put(K key,
V object)
将对象加入到缓存,使用默认失效时长
|
void |
put(K key,
V object,
long timeout)
将对象加入到缓存,使用指定失效时长
如果缓存空间满了, Cache.prune() 将被调用以获得空间来存放新对象 |
void |
remove(K key)
从缓存中移除对象
|
int |
size() |
long |
timeout() |
public void put(K key, V object)
Cacheput 在接口中 Cache<K,V>key - 键object - 缓存的对象Cache.put(Object, Object, long)public void put(K key, V object, long timeout)
CacheCache.prune() 将被调用以获得空间来存放新对象put 在接口中 Cache<K,V>key - 键object - 缓存的对象timeout - 失效时长Cache.put(Object, Object, long)public int prune()
CacheCopyright © 2016. All rights reserved.