Package org.apache.solr.common.util

## Class MapBackedCache<K,​V>

- java.lang.Object
- - org.apache.solr.common.util.MapBackedCache<K,​V>

All Implemented Interfaces:
  `Cache<K,​V>`

Direct Known Subclasses:
  `ObjectCache`

    public class MapBackedCache<K,​V>
    extends Object
    implements Cache<K,​V>

### Field Summary

Fields
`protected Map<K,​V>` `map`

### Constructor Summary

Constructors
`MapBackedCache​(Map<K,​V> map)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Map<K,​V>` `asMap()`
`void` `clear()`
`V` `computeIfAbsent​(K key, Function<? super K,​? extends V> mappingFunction)`
`V` `get​(K key)`
`V` `put​(K key, V val)`
`V` `remove​(K key)`

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

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

### Field Detail

#### map

    protected final Map<K,​V> map

### Constructor Detail

#### MapBackedCache

    public MapBackedCache​(Map<K,​V> map)

### Method Detail

#### asMap

    public Map<K,​V> asMap()

#### put

    public V put​(K key,
                 V val)

Specified by:
  `put` in interface `Cache<K,​V>`

#### get

    public V get​(K key)

Specified by:
  `get` in interface `Cache<K,​V>`

#### remove

    public V remove​(K key)

Specified by:
  `remove` in interface `Cache<K,​V>`

#### clear

    public void clear()

Specified by:
  `clear` in interface `Cache<K,​V>`

#### computeIfAbsent

    public V computeIfAbsent​(K key,
                             Function<? super K,​? extends V> mappingFunction)

Specified by:
  `computeIfAbsent` in interface `Cache<K,​V>`