All Known Implementing Classes:
CaffeineCache

public interface Cache<K,V>
A mapping from key to values.

It allows binding CachingVersionedLayers to various cache providers.

  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the estimated size provided by the underlying cache, -1 if not available.
    long
    Returns the estimated weight provided by the underlying cache, -1 if not available.
    long
    Returns the eviction count provided by the underlying cache, -1 if not available.
    long
    Returns the eviction weight provided by the underlying cache, -1 if not available.
    get(K key)
    Returns the value associated to a key.
    getAll(Iterable<? extends K> keys)
    Returns the values associated to the keys.
    void
    put(K key, V value)
    Associates a value with the provided key.
  • Method Details

    • estimatedSize

      long estimatedSize()
      Returns the estimated size provided by the underlying cache, -1 if not available.
    • estimatedWeight

      long estimatedWeight()
      Returns the estimated weight provided by the underlying cache, -1 if not available.
    • evictionCount

      long evictionCount()
      Returns the eviction count provided by the underlying cache, -1 if not available.
    • evictionWeight

      long evictionWeight()
      Returns the eviction weight provided by the underlying cache, -1 if not available.
    • get

      V get(K key)
      Returns the value associated to a key.

      It returns null if the key is not present in the cache.

    • getAll

      Map<K,V> getAll(Iterable<? extends K> keys)
      Returns the values associated to the keys.

      It returns only the entries that are already present in the cache.

    • put

      void put(K key, V value)
      Associates a value with the provided key.

      If the key is already present, it updates the value.