Class CaffeineCache<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this cache
    V - the type of mapped values
    All Implemented Interfaces:
    Cache<K,​V>

    public class CaffeineCache<K,​V>
    extends Object
    implements Cache<K,​V>
    A Cache based on Cache
    Author:
    Simon Legner
    • Constructor Detail

      • CaffeineCache

        public CaffeineCache​(@org.checkerframework.checker.index.qual.NonNegative long timeout)
    • Method Detail

      • get

        public V get​(K key)
        Description copied from interface: Cache
        Fetches the key from the cache
        Specified by:
        get in interface Cache<K,​V>
        Parameters:
        key - the key
        Returns:
        the corresponding value
        See Also:
        Map.get(java.lang.Object)
      • put

        public void put​(K key,
                        V value)
        Description copied from interface: Cache
        Stores a binding for the key and the value in the cache
        Specified by:
        put in interface Cache<K,​V>
        Parameters:
        key - the key
        value - the value
        See Also:
        Map.put(K, V)
      • remove

        public void remove​(K key)
        Description copied from interface: Cache
        Removes the binding for the key from the cache
        Specified by:
        remove in interface Cache<K,​V>
        Parameters:
        key - the key
        See Also:
        Map.remove(Object)
      • size

        public int size()
        Description copied from interface: Cache
        Returns the number of bindings in this cache
        Specified by:
        size in interface Cache<K,​V>
        Returns:
        the size
        See Also:
        Map.size()