com.maxmind.db

## Class CHMCache

- java.lang.Object
- - com.maxmind.db.CHMCache

- All Implemented Interfaces:
    NodeCache

      public class CHMCache
      extends Object
      implements NodeCache

  A simplistic cache using a `ConcurrentHashMap`. There's no eviction policy, it just fills up until reaching the specified capacity (or close enough at least, bounds check is not atomic :)

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.maxmind.db.NodeCache

      `NodeCache.Loader`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CHMCache()`
    `CHMCache(int capacity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `get(int key, NodeCache.Loader loader)` Get a value from the cache, loading it if necessary.

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

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

- - ### Constructor Detail

    - #### CHMCache

          public CHMCache()

    - #### CHMCache

          public CHMCache(int capacity)

  - ### Method Detail

    - #### get

          public Object get(int key,
                            NodeCache.Loader loader)
                     throws IOException

      Description copied from interface: `NodeCache`
      Get a value from the cache, loading it if necessary.
      Specified by:
        `get` in interface `NodeCache`
      Parameters:
        `key` - the cache key
        `loader` - the loader to use if the key is not in cache
      Returns:
        the cached or loaded value
      Throws:
        `IOException` - if loading fails