类 AbstractCache<K,V>
- 所有已实现的接口:
Cache<K,
,V> Closeable
,AutoCloseable
- 作者:
- huangli
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
close()
Clean resources created by this cache.final V
computeIfAbsent
(K key, Function<K, V> loader, boolean cacheNullWhenLoaderReturnNull) If there is a value associated with the key, return the value; otherwise use the loader load the value and return, and then update the cache.final V
computeIfAbsent
(K key, Function<K, V> loader, boolean cacheNullWhenLoaderReturnNull, long expireAfterWrite, TimeUnit timeUnit) If there is a value associated with the key, return the value; otherwise use the loader load the value and return, and then update the cache.final CacheGetResult<V>
Gets an entry from the cache.final MultiGetResult<K,
V> Gets a collection of entries from the Cache.boolean
isClosed()
void
notify
(CacheEvent e) final CacheResult
Associates the specified value with the specified key in the cache.final CacheResult
Copies all of the entries from the specified map to the cache.final CacheResult
PUT_IF_ABSENT
(K key, V value, long expireAfterWrite, TimeUnit timeUnit) If the specified key is not already associated with a value, associate it with the given value.final CacheResult
Removes the mapping for a key from this cache if it is present.final CacheResult
REMOVE_ALL
(Set<? extends K> keys) Removes entries for the specified keys.
-
构造器详细资料
-
AbstractCache
public AbstractCache()
-
-
方法详细资料
-
notify
-
GET
从接口复制的说明:Cache
Gets an entry from the cache.if the implementation supports asynchronous operation, the cache access may not completed after this method return. The invoke of getResultCode()/isSuccess()/getMessage()/getValue() on the result will block until cache operation is completed. Call future() method on the result will get a CompletionStage instance for asynchronous programming.
-
GET_ALL
从接口复制的说明:Cache
Gets a collection of entries from the Cache.if the implementation supports asynchronous operation, the cache access may not completed after this method return. The invoke of getResultCode()/isSuccess()/getMessage()/getValue() on the result will block until cache operation is completed. Call future() method on the result will get a CompletionStage instance for asynchronous programming.
-
computeIfAbsent
从接口复制的说明:Cache
If there is a value associated with the key, return the value; otherwise use the loader load the value and return, and then update the cache.- 指定者:
computeIfAbsent
在接口中Cache<K,
V> - 参数:
key
- the keyloader
- the value loadercacheNullWhenLoaderReturnNull
- true if null value returned by loader should put into cache use the key- 返回:
- the value
-
computeIfAbsent
public final V computeIfAbsent(K key, Function<K, V> loader, boolean cacheNullWhenLoaderReturnNull, long expireAfterWrite, TimeUnit timeUnit) 从接口复制的说明:Cache
If there is a value associated with the key, return the value; otherwise use the loader load the value and return, and then update the cache.- 指定者:
computeIfAbsent
在接口中Cache<K,
V> - 参数:
key
- the keyloader
- the value loadercacheNullWhenLoaderReturnNull
- true if null value returned by loader should put into cache use the keyexpireAfterWrite
- the TTL(time to live) of the KV associationtimeUnit
- the time unit of expireAfterWrite- 返回:
- the value
-
PUT
从接口复制的说明:Cache
Associates the specified value with the specified key in the cache.if the implementation supports asynchronous operation, the cache access may not completed after this method return. The invoke of getResultCode()/isSuccess()/getMessage() on the result will block until cache operation is completed. Call future() method on the result will get a CompletionStage instance for asynchronous programming.
-
PUT_ALL
public final CacheResult PUT_ALL(Map<? extends K, ? extends V> map, long expireAfterWrite, TimeUnit timeUnit) 从接口复制的说明:Cache
Copies all of the entries from the specified map to the cache.if the implementation supports asynchronous operation, the cache access may not completed after this method return. The invoke of getResultCode()/isSuccess()/getMessage() on the result will block until cache operation is completed. Call future() method on the result will get a CompletionStage instance for asynchronous programming.
-
REMOVE
从接口复制的说明:Cache
Removes the mapping for a key from this cache if it is present.if the implementation supports asynchronous operation, the cache access may not completed after this method return. The invoke of getResultCode()/isSuccess()/getMessage() on the result will block until cache operation is completed. Call future() method on the result will get a CompletionStage instance for asynchronous programming.
-
REMOVE_ALL
从接口复制的说明:Cache
Removes entries for the specified keys.if the implementation supports asynchronous operation, the cache access may not completed after this method return. The invoke of getResultCode()/isSuccess()/getMessage() on the result will block until cache operation is completed. Call future() method on the result will get a CompletionStage instance for asynchronous programming.
- 指定者:
REMOVE_ALL
在接口中Cache<K,
V> - 参数:
keys
- the keys to remove- 返回:
- the result
-
PUT_IF_ABSENT
从接口复制的说明:Cache
If the specified key is not already associated with a value, associate it with the given value.if the implementation supports asynchronous operation, the cache access may not completed after this method return. The invoke of getResultCode()/isSuccess()/getMessage() on the result will block until cache operation is completed. Call future() method on the result will get a CompletionStage instance for asynchronous programming.
- 指定者:
PUT_IF_ABSENT
在接口中Cache<K,
V> - 参数:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keyexpireAfterWrite
- the TTL(time to live) of the KV associationtimeUnit
- the time unit of expireAfterWrite- 返回:
- SUCCESS if the specified key is not already associated with a value, or EXISTS if the specified key is already associated with a value, or FAIL if error occurs.
-
close
public void close()从接口复制的说明:Cache
Clean resources created by this cache. -
isClosed
public boolean isClosed()
-