K - V - public interface Cache<K,V>
| 限定符和类型 | 方法和说明 |
|---|---|
<A,B> Cache<A,B> |
cacheSize(int cacheSize)
设置缓存大小
|
void |
clear()
清除所有缓存对象
|
void |
del(K key)
删除缓存对象
|
<F> void |
del(K key,
F field)
删除缓存对象
|
int |
eliminate()
淘汰对象
|
<A,B> Cache<A,B> |
expire(long expire)
设置缓存有效期
|
<F> Set<F> |
flieds(K key) |
V |
get(K key)
查找缓存对象
|
int |
getCacheSize()
返回缓存大小
|
void |
hdel(K key)
删除缓存对象
|
<F> V |
hget(K key,
F field)
查找缓存对象
|
<F> void |
hset(K key,
F field,
V value)
向缓存添加一个hash类型的数据
|
<F> void |
hset(K key,
F field,
V value,
long expire)
向缓存添加一个hash类型的数据并设置有效期
|
boolean |
isEmpty()
缓存中是否为空
|
boolean |
isFull()
缓存是否已经满
|
Set<K> |
keys() |
void |
set(K key,
V value)
向缓存添加value对象,其在缓存中生存时间为默认值
|
void |
set(K key,
V value,
long expire)
向缓存添加value对象,并指定存活时间
|
int |
size() |
void set(K key, V value)
key - value - CacheExceptionvoid set(K key, V value, long expire)
key - value - 过期时间expire - CacheException<F> void hset(K key, F field, V value, long expire)
key - field - value - expire - V get(K key)
key - CacheExceptionvoid del(K key)
key - void hdel(K key)
key - <F> void del(K key, F field)
key - field - int size()
int eliminate()
boolean isFull()
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.