edu.northwestern.at.utils.cache

## Interface Cache<K,V>

- All Known Implementing Classes:
    DummyCache, LRUCache, OldLRUCache, SoftReferenceCache

      public interface Cache<K,V>

  A simple generic cache interface.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clear all entries in the cache.
    `boolean` | `containsKey(K key)` True if cache contains a specified key.
    `V` | `get(K key)` Retrieve a cached value.
    `V` | `put(K key, V value)` Add or replace a cached value.
    `V` | `remove(K key)` Remove a specific entry from the cache.
    `int` | `size()` Return current size of cache.

- - ### Method Detail

    - #### clear

          void clear()

      Clear all entries in the cache.

    - #### containsKey

          boolean containsKey(K key)

      True if cache contains a specified key.
      Parameters:
        `key` - The key to look up.
      Returns:
        true if the cache contains the key.

    - #### get

          V get(K key)

      Retrieve a cached value.
      Parameters:
        `key` - The key of the entry to retrieve.
      Returns:
        The value of the cached entry specified by key; null if the cache does not contain the key.

    - #### put

          V put(K key,
              V value)

      Add or replace a cached value.
      Parameters:
        `key` - The key of the entry to add.
        `value` - The value of the entry to add.
      Returns:
        The value of any existing cached entry specified by the key; null if the cache does not contain the key.

    - #### remove

          V remove(K key)

      Remove a specific entry from the cache.
      Parameters:
        `key` - The key of the entry to remove.
      Returns:
        The entry removed, or null if none.

    - #### size

          int size()

      Return current size of cache.
      Returns:
        Number of entries (keys) currently stored in cache.