K - V - public interface Cache<K,V>
| 限定符和类型 | 方法和说明 |
|---|---|
<A,B> Cache<A,B> |
cacheSize(int cacheSize)
设置缓存大小
|
void |
clear()
清除所有缓存对象
|
int |
eliminate()
淘汰对象
|
<A,B> Cache<A,B> |
expire(long expire)
设置缓存有效期
|
V |
get(K key)
查找缓存对象
|
int |
getCacheSize()
返回缓存大小
|
boolean |
isEmpty()
缓存中是否为空
|
boolean |
isFull()
缓存是否已经满
|
void |
put(K key,
V value)
向缓存添加value对象,其在缓存中生存时间为默认值
|
void |
put(K key,
V value,
long expire)
向缓存添加value对象,并指定存活时间
|
void |
remove(K key)
删除缓存对象
|
int |
size() |
void put(K key, V value)
key - value - CacheExceptionvoid put(K key, V value, long expire)
key - value - 过期时间expire - CacheExceptionV get(K key)
key - CacheExceptionint size()
int eliminate()
boolean isFull()
void remove(K key)
key - void clear()
int getCacheSize()
boolean isEmpty()
<A,B> Cache<A,B> cacheSize(int cacheSize)
cacheSize - <A,B> Cache<A,B> expire(long expire)
expire - Copyright © 2015. All rights reserved.