Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.simpleframework.xml.util
Interface Cache<K,V>

All Known Implementing Classes:
  WeakCache

    public interface Cache<K,V>

The `Cache` interface is used to represent a cache that will store key value pairs. The cache exposes only several methods to ensure that implementations can focus on performance concerns rather than how to manage the cached values.

Author:
  Niall Gallagher

Method Summary
`void` | `cache(K key, V value)` This method is used to insert a key value mapping in to the cache.
`boolean` | `contains(K key)` This is used to determine whether the specified key exists with in the cache.
`V` | `fetch(K key)` This method is used to get the value from the cache that is mapped to the specified key.
`V` | `take(K key)` This is used to exclusively take the value mapped to the specified key from the cache.

Method Detail

### cache

    void cache(K key,
               V value)

  This method is used to insert a key value mapping in to the cache. The value can later be retrieved or removed from the cache if desired. If the value associated with the key is null then nothing is stored within the cache.

  Parameters:
    `key` - this is the key to cache the provided value to
    `value` - this is the value that is to be cached

### take

    V take(K key)

  This is used to exclusively take the value mapped to the specified key from the cache. Invoking this is effectively removing the value from the cache.

  Parameters:
    `key` - this is the key to acquire the cache value with
  Returns:
    this returns the value mapped to the specified key

### fetch

    V fetch(K key)

  This method is used to get the value from the cache that is mapped to the specified key. If there is no value mapped to the specified key then this method will return a null.

  Parameters:
    `key` - this is the key to acquire the cache value with
  Returns:
    this returns the value mapped to the specified key

### contains

    boolean contains(K key)

  This is used to determine whether the specified key exists with in the cache. Typically this can be done using the fetch method, which will acquire the object.

  Parameters:
    `key` - this is the key to check within this segment
  Returns:
    true if the specified key is within the cache

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD