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
Modifier and Type
Field
Description
`protected final Map<K,V>`
`map`

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`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 Details

### map

protected final Map<K,V> map

## Constructor Details

### MapBackedCache

public MapBackedCache(Map<K,V> map)

## Method Details

### 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>`