Package org.apache.groovy.json.internal

# Interface Cache<KEY,VALUE>

Type Parameters:
  `KEY` - key
  `VALUE` - value

All Known Implementing Classes:
  `SimpleCache`

public interface Cache<KEY,VALUE>
Cache

- ## Method Summary

  Modifier and Type
  Method
  Description
  `VALUE`
  `get(KEY key)`
  Retrieves a value and updates cache state as needed.
  `VALUE`
  `getSilent(KEY key)`
  Retrieves a value using implementation-specific silent access semantics.
  `void`
  `put(KEY key, VALUE value)`
  Stores a value under the supplied key.
  `void`
  `remove(KEY key)`
  Removes the value stored for the supplied key.
  `int`
  `size()`
  Returns the current number of cached entries.

- ## Method Details

  - ### put

    void put(KEY key, VALUE value)
    Stores a value under the supplied key.
    Parameters:
      `key` - the cache key
      `value` - the cached value

  - ### get

    VALUE get(KEY key)
    Retrieves a value and updates cache state as needed.
    Parameters:
      `key` - the cache key
    Returns:
      the cached value, or `null` if absent

  - ### getSilent

    VALUE getSilent(KEY key)
    Retrieves a value using implementation-specific silent access semantics.
    Parameters:
      `key` - the cache key
    Returns:
      the cached value, or `null` if absent

  - ### remove

    void remove(KEY key)
    Removes the value stored for the supplied key.
    Parameters:
      `key` - the cache key

  - ### size

    int size()
    Returns the current number of cached entries.
    Returns:
      the cache size