org.apache.lucene.util.cache

## Class SimpleMapCache

- java.lang.Object
- - org.apache.lucene.util.cache.Cache
  - - org.apache.lucene.util.cache.SimpleMapCache

- Direct Known Subclasses:
    SimpleLRUCache

      public class SimpleMapCache
      extends Cache

  Simple cache implementation that uses a HashMap to store (key, value) pairs. This cache is not synchronized, use `Cache.synchronizedCache(Cache)` if needed.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleMapCache()`
    `SimpleMapCache(java.util.Map map)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the cache.
    `boolean` | `containsKey(java.lang.Object key)` Returns whether the given key is in this cache.
    `java.lang.Object` | `get(java.lang.Object key)` Returns the value for the given key.
    `java.util.Set` | `keySet()` Returns a Set containing all keys in this cache.
    `void` | `put(java.lang.Object key, java.lang.Object value)` Puts a (key, value)-pair into the cache.

    - ### Methods inherited from class org.apache.lucene.util.cache.Cache

      `synchronizedCache`

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

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

- - ### Constructor Detail

    - #### SimpleMapCache

          public SimpleMapCache()

    - #### SimpleMapCache

          public SimpleMapCache(java.util.Map map)

  - ### Method Detail

    - #### get

          public java.lang.Object get(java.lang.Object key)

      Description copied from class: `Cache`
      Returns the value for the given key.
      Specified by:
        `get` in class `Cache`

    - #### put

          public void put(java.lang.Object key,
                          java.lang.Object value)

      Description copied from class: `Cache`
      Puts a (key, value)-pair into the cache.
      Specified by:
        `put` in class `Cache`

    - #### close

          public void close()

      Description copied from class: `Cache`
      Closes the cache.
      Specified by:
        `close` in class `Cache`

    - #### containsKey

          public boolean containsKey(java.lang.Object key)

      Description copied from class: `Cache`
      Returns whether the given key is in this cache.
      Specified by:
        `containsKey` in class `Cache`

    - #### keySet

          public java.util.Set keySet()

      Returns a Set containing all keys in this cache.

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.