Package: org.apache.groovy.json.internal

## [Java] Class SimpleCache<K, V>

- org.apache.groovy.json.internal.SimpleCache

- All Implemented Interfaces and Traits:
    Cache

      public class SimpleCache<K, V>
      extends Object
      implements Cache

  Thin adapter that exposes CommonCache through the internal Cache API.

  Type Parameters:
    `K` - the key type
    `V` - the value type

- - ### Constructor Summary

    Constructors
    Constructor and description
    `SimpleCache(int limit, CacheType type)` Creates a cache with the supplied size limit and eviction policy.
    `SimpleCache(int limit)` Creates an LRU cache with the supplied size limit.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public V` | `get(K key)` {@inheritDoc}
    `` | `public V` | `getSilent(K key)` {@inheritDoc}
    `` | `public void` | `put(K key, V value)` {@inheritDoc}
    `` | `public void` | `remove(K key)` {@inheritDoc}
    `` | `public int` | `size()` Returns the current number of cached entries. Returns: the cache size
    `` | `public String` | `toString()` Returns the underlying cache state as a string.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public SimpleCache(int limit, CacheType type)

      Creates a cache with the supplied size limit and eviction policy.

      Parameters:
        `limit` - the maximum number of entries
        `type` - the eviction strategy

    - #### public SimpleCache(int limit)

      Creates an LRU cache with the supplied size limit.

      Parameters:
        `limit` - the maximum number of entries

  - ### Method Detail

    - #### public V get(K key)

      {@inheritDoc}

    - #### public V getSilent(K key)

      {@inheritDoc}

    - #### public void put(K key, V value)

      {@inheritDoc}

    - #### public void remove(K key)

      {@inheritDoc}

    - #### public int size()

      Returns the current number of cached entries.

      Returns:
        the cache size

    - #### public String toString()

      Returns the underlying cache state as a string.

      Returns:
        the cache state string