org.apache.solr.common.util

## Class ObjectCache

- java.lang.Object
- - org.apache.solr.common.util.MapBackedCache<String,Object>
  - - org.apache.solr.common.util.ObjectCache

All Implemented Interfaces:
  Closeable, AutoCloseable, SolrCloseable, Cache<String,Object>

    public class ObjectCache
    extends MapBackedCache<String,Object>
    implements SolrCloseable

Simple object cache with a type-safe accessor.

### Field Summary

### Fields inherited from class org.apache.solr.common.util.MapBackedCache

`map`

### Constructor Summary

Constructors
Constructor and Description
`ObjectCache()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clear()`
`void` `close()`
`<T> T` `computeIfAbsent(String key, Class<T> clazz, Function<String,? extends T> mappingFunction)`
`Object` `get(String key)`
`<T> T` `get(String key, Class<T> clazz)`
`boolean` `isClosed()`
`Object` `put(String key, Object val)`
`Object` `remove(String key)`

### Methods inherited from class org.apache.solr.common.util.MapBackedCache

`asMap, computeIfAbsent`

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

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

### Constructor Detail

#### ObjectCache

    public ObjectCache()

### Method Detail

#### put

    public Object put(String key,
                      Object val)

Specified by:
  `put` in interface `Cache<String,Object>`
Overrides:
  `put` in class `MapBackedCache<String,Object>`

#### get

    public Object get(String key)

Specified by:
  `get` in interface `Cache<String,Object>`
Overrides:
  `get` in class `MapBackedCache<String,Object>`

#### remove

    public Object remove(String key)

Specified by:
  `remove` in interface `Cache<String,Object>`
Overrides:
  `remove` in class `MapBackedCache<String,Object>`

#### clear

    public void clear()

Specified by:
  `clear` in interface `Cache<String,Object>`
Overrides:
  `clear` in class `MapBackedCache<String,Object>`

#### get

    public <T> T get(String key,
                     Class<T> clazz)

#### computeIfAbsent

    public <T> T computeIfAbsent(String key,
                                 Class<T> clazz,
                                 Function<String,? extends T> mappingFunction)

#### isClosed

    public boolean isClosed()

Specified by:
  `isClosed` in interface `SolrCloseable`

#### close

    public void close()
               throws IOException

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Throws:
  `IOException`