类 AbstractCache<K,V>

java.lang.Object
com.alicp.jetcache.AbstractCache<K,V>
所有已实现的接口:
Cache<K,V>, Closeable, AutoCloseable
直接已知子类:
AbstractEmbeddedCache, AbstractExternalCache, MultiLevelCache

public abstract class AbstractCache<K,V> extends Object implements Cache<K,V>
Created on 2016/10/7.
作者:
huangli
  • 构造器详细资料

    • AbstractCache

      public AbstractCache()
  • 方法详细资料

    • notify

      public void notify(CacheEvent e)
    • GET

      public final CacheGetResult<V> GET(K key)
      从接口复制的说明: 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 在接口中 Cache<K,V>
      参数:
      key - the key
      返回:
      the result
    • GET_ALL

      public final MultiGetResult<K,V> GET_ALL(Set<? extends K> keys)
      从接口复制的说明: 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.

      指定者:
      GET_ALL 在接口中 Cache<K,V>
      参数:
      keys - the key collection
      返回:
      the result
    • computeIfAbsent

      public final V computeIfAbsent(K key, Function<K,V> loader, boolean cacheNullWhenLoaderReturnNull)
      从接口复制的说明: 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 key
      loader - the value loader
      cacheNullWhenLoaderReturnNull - 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 key
      loader - the value loader
      cacheNullWhenLoaderReturnNull - true if null value returned by loader should put into cache use the key
      expireAfterWrite - the TTL(time to live) of the KV association
      timeUnit - the time unit of expireAfterWrite
      返回:
      the value
    • PUT

      public final CacheResult PUT(K key, V value, long expireAfterWrite, TimeUnit timeUnit)
      从接口复制的说明: 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 在接口中 Cache<K,V>
      参数:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      expireAfterWrite - the TTL(time to live) of the KV association
      timeUnit - the time unit of expireAfterWrite
      返回:
      the result
    • 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.

      指定者:
      PUT_ALL 在接口中 Cache<K,V>
      参数:
      map - mappings to be stored in this cache.
      expireAfterWrite - the TTL(time to live) of the KV association
      timeUnit - the time unit of expireAfterWrite
      返回:
      the result
    • REMOVE

      public final CacheResult REMOVE(K key)
      从接口复制的说明: 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 在接口中 Cache<K,V>
      参数:
      key - key whose mapping is to be removed from the cache
      返回:
      the result
    • REMOVE_ALL

      public final CacheResult REMOVE_ALL(Set<? extends K> keys)
      从接口复制的说明: 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

      public final CacheResult PUT_IF_ABSENT(K key, V value, long expireAfterWrite, TimeUnit timeUnit)
      从接口复制的说明: 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 associated
      value - value to be associated with the specified key
      expireAfterWrite - the TTL(time to live) of the KV association
      timeUnit - 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.
      指定者:
      close 在接口中 AutoCloseable
      指定者:
      close 在接口中 Cache<K,V>
      指定者:
      close 在接口中 Closeable
    • isClosed

      public boolean isClosed()