类 AutoExpireCache<K,​V>

  • 所有已实现的接口:
    Cache<K,​V>

    public class AutoExpireCache<K,​V>
    extends java.lang.Object
    implements Cache<K,​V>
    A wrapper that automatically expires the cache.
    作者:
    zzq
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      private CacheItemProperties cacheItemProperties()  
      void clear()
      Clear the entire cache.
      V get​(K key)
      Take the corresponding value from the cache according to the cache key.
      V get​(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.
      int getSize()
      Returns the number of key-value pairs in the cache.
      private boolean isExpire​(CacheItemProperties itemProperties)  
      void put​(K key, V val)
      Cache a pair of key value.
      V remove​(K key)
      Take the corresponding value from the cache according to the cache key, and remove this record from the cache.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • expireNanos

        private long expireNanos
      • delegate

        private Cache<K,​V> delegate
    • 构造器详细资料

      • AutoExpireCache

        public AutoExpireCache​(Cache<K,​V> delegate,
                               long expireNanos)
    • 方法详细资料

      • put

        public void put​(K key,
                        V val)
        从接口复制的说明: Cache
        Cache a pair of key value. If the key value already exists, the value will be overwritten.
        指定者:
        put 在接口中 Cache<K,​V>
        参数:
        key - cache key
        val - cache value
      • get

        public V get​(K key)
        从接口复制的说明: Cache
        Take the corresponding value from the cache according to the cache key.
        指定者:
        get 在接口中 Cache<K,​V>
        参数:
        key - cache key
        返回:
        cache value
      • get

        public V get​(K key,
                     java.util.concurrent.Callable<? extends V> call)
              throws java.lang.Exception
        从接口复制的说明: Cache
        Get the value in the cache according to the primary key, and put it into the cache after processing by the function.
        指定者:
        get 在接口中 Cache<K,​V>
        参数:
        key - cache key
        call - 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

        public V remove​(K key)
        从接口复制的说明: Cache
        Take the corresponding value from the cache according to the cache key, and remove this record from the cache.
        指定者:
        remove 在接口中 Cache<K,​V>
        参数:
        key - cache key
        返回:
        cache value
      • clear

        public void clear()
        从接口复制的说明: Cache
        Clear the entire cache.
        指定者:
        clear 在接口中 Cache<K,​V>
      • getSize

        public int getSize()
        从接口复制的说明: Cache
        Returns the number of key-value pairs in the cache.
        指定者:
        getSize 在接口中 Cache<K,​V>
        返回:
        number of key-value pairs