Interface Cache<K,V>

Type Parameters:
K - Type of key.
V - Type of values.

public interface Cache<K,V>
Cache of values identified by a key. It is important to note that:
  • Keys should be immutable
  • Null values should not be allowed
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear cache.
    load(K key)
    Get entry in cache.
    long
    Get the size of the cache.
  • Method Details

    • load

      V load(K key)
      Get entry in cache. If entry is not in the cache, the cache value should be computed and added to the cache.
      Parameters:
      key - Value identifier.
      Returns:
      The cache value.
    • clear

      void clear()
      Clear cache.
    • size

      long size()
      Get the size of the cache.
      Returns:
      Cache size.