接口 Cache<K,V>
-
- 所有已知实现类:
AutoExpireCache,LruCache,SimpleCache,SynchronizedCache
public interface Cache<K,V>Cache method collection definition.- 作者:
- zzq
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidclear()Clear the entire cache.Vget(K key)Take the corresponding value from the cache according to the cache key.Vget(K key, java.util.concurrent.Callable<? extends V> call)Get the value in the cache according to the primary key, and put it into the cache after processing by the function.intgetSize()Returns the number of key-value pairs in the cache.voidput(K key, V val)Cache a pair of key value.Vremove(K key)Take the corresponding value from the cache according to the cache key, and remove this record from the cache.
-
-
-
方法详细资料
-
put
void put(K key, V val)
Cache a pair of key value. If the key value already exists, the value will be overwritten.- 参数:
key- cache keyval- cache value
-
get
V get(K key)
Take the corresponding value from the cache according to the cache key.- 参数:
key- cache key- 返回:
- cache value
-
get
V get(K key, java.util.concurrent.Callable<? extends V> call) throws java.lang.Exception
Get the value in the cache according to the primary key, and put it into the cache after processing by the function.- 参数:
key- cache keycall- a function, the return value of the function will be updated to the cache- 返回:
- cache value
- 抛出:
java.lang.Exception- callable function interface throw exception
-
remove
V remove(K key)
Take the corresponding value from the cache according to the cache key, and remove this record from the cache.- 参数:
key- cache key- 返回:
- cache value
-
clear
void clear()
Clear the entire cache.
-
getSize
int getSize()
Returns the number of key-value pairs in the cache.- 返回:
- number of key-value pairs
-
-