类 RefreshCache<K,V>

所有已实现的接口:
Cache<K,V>, ProxyCache<K,V>, Closeable, AutoCloseable

public class RefreshCache<K,V> extends LoadingCache<K,V>
Created on 2017/5/25.
作者:
huangli
  • 字段详细资料

    • LOCK_KEY_SUFFIX

      public static final byte[] LOCK_KEY_SUFFIX
    • TIMESTAMP_KEY_SUFFIX

      public static final byte[] TIMESTAMP_KEY_SUFFIX
  • 构造器详细资料

    • RefreshCache

      public RefreshCache(Cache cache)
  • 方法详细资料

    • close

      public void close()
      从接口复制的说明: Cache
      Clean resources created by this cache.
      指定者:
      close 在接口中 AutoCloseable
      指定者:
      close 在接口中 Cache<K,V>
      指定者:
      close 在接口中 Closeable
      覆盖:
      close 在类中 SimpleProxyCache<K,V>
    • computeIfAbsent

      public V computeIfAbsent(K key, Function<K,V> loader)
      从接口复制的说明: 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>
      覆盖:
      computeIfAbsent 在类中 SimpleProxyCache<K,V>
      参数:
      key - the key
      loader - the value loader
      返回:
      the value
      另请参阅:
    • computeIfAbsent

      public 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>
      覆盖:
      computeIfAbsent 在类中 SimpleProxyCache<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 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>
      覆盖:
      computeIfAbsent 在类中 SimpleProxyCache<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
    • get

      public V get(K key) throws CacheInvokeException
      从接口复制的说明: Cache
      Gets an entry from the cache.

      If the cache's builder has specified a CacheLoader and there is no association in the cache , it will attempt to load the entry.

      If error occurs during cache access, the method return null instead of throwing an exception.

      指定者:
      get 在接口中 Cache<K,V>
      覆盖:
      get 在类中 LoadingCache<K,V>
      参数:
      key - the key whose associated value is to be returned
      返回:
      the associated value. null may indicates:
      • the entry does not exist or expired
      • the entry value is null
      • error occurs during cache access(no exception throws)
      抛出:
      CacheInvokeException - only if loader throws an exception
      另请参阅:
    • getAll

      public Map<K,V> getAll(Set<? extends K> keys) throws CacheInvokeException
      从接口复制的说明: Cache
      Gets a collection of entries from the Cache, returning them as Map of the values associated with the set of keys requested.

      If the cache's builder has specified a CacheLoader and there is no association in the cache , it will attempt to load the entry.

      If error occurs during cache access, the method will not throw an exception.

      指定者:
      getAll 在接口中 Cache<K,V>
      覆盖:
      getAll 在类中 LoadingCache<K,V>
      参数:
      keys - The keys whose associated values are to be returned.
      返回:
      A map of entries that were found for the given keys. Keys not found in the cache are not in the returned map.
      抛出:
      CacheInvokeException - only if loader throws an exception
      另请参阅: