com.fasterxml.jackson.databind.cfg

## Class DefaultCacheProvider

- java.lang.Object
- - com.fasterxml.jackson.databind.cfg.DefaultCacheProvider

All Implemented Interfaces:
  CacheProvider, Serializable

    public class DefaultCacheProvider
    extends Object
    implements CacheProvider

The default implementation of `CacheProvider`. Configuration is builder-based via `DefaultCacheProvider.Builder`.

Users can either use this class or create their own `CacheProvider` implementation.

Since:
  2.16
See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `DefaultCacheProvider.Builder` Builder offering fluent factory methods to configure `DefaultCacheProvider`, keeping it immutable.

### Field Summary

Fields
`protected int` `_maxDeserializerCacheSize` Maximum size of the `LookupCache` instance constructed by `forDeserializerCache(DeserializationConfig)`.
`protected int` `_maxSerializerCacheSize` Maximum size of the `LookupCache` instance constructed by `forSerializerCache(SerializationConfig)`
`protected int` `_maxTypeFactoryCacheSize` Maximum size of the `LookupCache` instance constructed by `forTypeFactory()`.

### Constructor Summary

Constructors
`protected` `DefaultCacheProvider(int maxDeserializerCacheSize, int maxSerializerCacheSize, int maxTypeFactoryCacheSize)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected <K,V> LookupCache<K,V>` `_buildCache(int maxSize)`
`static DefaultCacheProvider.Builder` `builder()`
`static CacheProvider` `defaultInstance()`
`LookupCache<JavaType,JsonDeserializer<Object>>` `forDeserializerCache(DeserializationConfig config)` Method to provide a `LookupCache` instance for constructing `DeserializerCache`.
`LookupCache<TypeKey,JsonSerializer<Object>>` `forSerializerCache(SerializationConfig config)` Method for constructing a `LookupCache` instance to be used by `SerializerCache`.
`LookupCache<Object,JavaType>` `forTypeFactory()` Method for constructing a `LookupCache` instance to be used by `TypeFactory`.

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

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

### Field Detail

#### _maxDeserializerCacheSize

    protected final int _maxDeserializerCacheSize

Maximum size of the `LookupCache` instance constructed by `forDeserializerCache(DeserializationConfig)`.

See Also:
  `DefaultCacheProvider.Builder.maxDeserializerCacheSize(int)`

#### _maxSerializerCacheSize

    protected final int _maxSerializerCacheSize

Maximum size of the `LookupCache` instance constructed by `forSerializerCache(SerializationConfig)`

See Also:
  `DefaultCacheProvider.Builder.maxSerializerCacheSize(int)`

#### _maxTypeFactoryCacheSize

    protected final int _maxTypeFactoryCacheSize

Maximum size of the `LookupCache` instance constructed by `forTypeFactory()`.

See Also:
  `DefaultCacheProvider.Builder.maxTypeFactoryCacheSize(int)`

### Constructor Detail

#### DefaultCacheProvider

    protected DefaultCacheProvider(int maxDeserializerCacheSize,
                                   int maxSerializerCacheSize,
                                   int maxTypeFactoryCacheSize)

### Method Detail

#### defaultInstance

    public static CacheProvider defaultInstance()

Returns:
  Default `DefaultCacheProvider` instance using default configuration values.

#### forDeserializerCache

    public LookupCache<JavaType,JsonDeserializer<Object>> forDeserializerCache(DeserializationConfig config)

Method to provide a `LookupCache` instance for constructing `DeserializerCache`. Implementation should match `DeserializerCache(int)`.

Specified by:
  `forDeserializerCache` in interface `CacheProvider`
Returns:
  `LookupCache` instance for constructing `DeserializerCache`.

#### forSerializerCache

    public LookupCache<TypeKey,JsonSerializer<Object>> forSerializerCache(SerializationConfig config)

Description copied from interface: `CacheProvider`
Method for constructing a `LookupCache` instance to be used by `SerializerCache`.

Specified by:
  `forSerializerCache` in interface `CacheProvider`
Returns:
  `LookupCache` instance for constructing `SerializerCache`.

#### forTypeFactory

    public LookupCache<Object,JavaType> forTypeFactory()

Description copied from interface: `CacheProvider`
Method for constructing a `LookupCache` instance to be used by `TypeFactory`.

Specified by:
  `forTypeFactory` in interface `CacheProvider`
Returns:
  `LookupCache` instance for constructing `TypeFactory`.

#### _buildCache

    protected <K,V> LookupCache<K,V> _buildCache(int maxSize)

#### builder

    public static DefaultCacheProvider.Builder builder()

Returns:
  `DefaultCacheProvider.Builder` instance for configuration.