com.h3c.util.cache

## Class SmallDataCache<K,V>

- java.lang.Object
- - com.h3c.util.cache.SmallDataCache<K,V>

- Type Parameters:
    `K` - type of the key to identify a cached value.
    `V` - type of the cached value.
  All Implemented Interfaces:
    Cache<K,V>

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

  Cache to hold the entire data from the model. Data is never deleted unless `Cache.invalidate(Object)` or `Cache.clear()` is called.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SmallDataCache()` Creates a new `Cache`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears the cache.
    `V` | `get(K key)` Gets a value from the cache.
    `Collection<V>` | `getContent()` Gets the cache's content.
    `void` | `invalidate(K key)` Invalidates a key.
    `void` | `put(K key, V value)` Puts a value into the cache.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SmallDataCache

          public SmallDataCache()

      Creates a new `Cache`.

  - ### Method Detail

    - #### put

          public void put(K key,
                 V value)

      Description copied from interface: `Cache`
      Puts a value into the cache.
      Specified by:
        `put` in interface `Cache<K,V>`
      Parameters:
        `key` - key.
        `value` - value.

    - #### get

          public V get(K key)

      Description copied from interface: `Cache`
      Gets a value from the cache.
      Specified by:
        `get` in interface `Cache<K,V>`
      Parameters:
        `key` - value's key.
      Returns:
        the value associated to the given key if it exists in the cache, `null` otherwise.

    - #### invalidate

          public void invalidate(K key)

      Description copied from interface: `Cache`
      Invalidates a key. This will cause the key to be removed from the cache. This method should be called when the object associated to the given key is no longer valid (A new copy should be retrieved from the model in the next read or the object no longer exists in the model). Deletion of entries from the cache due space management should be handled by the cache's implementation.
      Specified by:
        `invalidate` in interface `Cache<K,V>`
      Parameters:
        `key` - key to invalidate.

    - #### clear

          public void clear()

      Description copied from interface: `Cache`
      Clears the cache.
      Specified by:
        `clear` in interface `Cache<K,V>`

    - #### getContent

          public Collection<V> getContent()

      Gets the cache's content.
      Returns:
        the cache's content.

Copyright © 2014. All Rights Reserved.