Class DefaultCacheProvider
- java.lang.Object
-
- com.fasterxml.jackson.databind.cfg.DefaultCacheProvider
-
- All Implemented Interfaces:
CacheProvider
,java.io.Serializable
public class DefaultCacheProvider extends java.lang.Object implements CacheProvider
The default implementation ofCacheProvider
. Configuration is builder-based viaDefaultCacheProvider.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 Modifier and Type Class Description static class
DefaultCacheProvider.Builder
Builder offering fluent factory methods to configureDefaultCacheProvider
, keeping it immutable.
-
Field Summary
Fields Modifier and Type Field Description protected int
_maxDeserializerCacheSize
Maximum size of theLookupCache
instance constructed byforDeserializerCache(DeserializationConfig)
.protected int
_maxSerializerCacheSize
Maximum size of theLookupCache
instance constructed byforSerializerCache(SerializationConfig)
protected int
_maxTypeFactoryCacheSize
Maximum size of theLookupCache
instance constructed byforTypeFactory()
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultCacheProvider(int maxDeserializerCacheSize, int maxSerializerCacheSize, int maxTypeFactoryCacheSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <K,V>
LookupCache<K,V>_buildCache(int maxSize)
static DefaultCacheProvider.Builder
builder()
static CacheProvider
defaultInstance()
LookupCache<JavaType,JsonDeserializer<java.lang.Object>>
forDeserializerCache(DeserializationConfig config)
Method to provide aLookupCache
instance for constructingDeserializerCache
.LookupCache<TypeKey,JsonSerializer<java.lang.Object>>
forSerializerCache(SerializationConfig config)
Method for constructing aLookupCache
instance to be used bySerializerCache
.LookupCache<java.lang.Object,JavaType>
forTypeFactory()
Method for constructing aLookupCache
instance to be used byTypeFactory
.
-
-
-
Field Detail
-
_maxDeserializerCacheSize
protected final int _maxDeserializerCacheSize
Maximum size of theLookupCache
instance constructed byforDeserializerCache(DeserializationConfig)
.
-
_maxSerializerCacheSize
protected final int _maxSerializerCacheSize
Maximum size of theLookupCache
instance constructed byforSerializerCache(SerializationConfig)
-
_maxTypeFactoryCacheSize
protected final int _maxTypeFactoryCacheSize
Maximum size of theLookupCache
instance constructed byforTypeFactory()
.
-
-
Method Detail
-
defaultInstance
public static CacheProvider defaultInstance()
- Returns:
- Default
DefaultCacheProvider
instance using default configuration values.
-
forDeserializerCache
public LookupCache<JavaType,JsonDeserializer<java.lang.Object>> forDeserializerCache(DeserializationConfig config)
Method to provide aLookupCache
instance for constructingDeserializerCache
. Implementation should matchDeserializerCache(int)
.- Specified by:
forDeserializerCache
in interfaceCacheProvider
- Returns:
LookupCache
instance for constructingDeserializerCache
.
-
forSerializerCache
public LookupCache<TypeKey,JsonSerializer<java.lang.Object>> forSerializerCache(SerializationConfig config)
Description copied from interface:CacheProvider
Method for constructing aLookupCache
instance to be used bySerializerCache
.- Specified by:
forSerializerCache
in interfaceCacheProvider
- Returns:
LookupCache
instance for constructingSerializerCache
.
-
forTypeFactory
public LookupCache<java.lang.Object,JavaType> forTypeFactory()
Description copied from interface:CacheProvider
Method for constructing aLookupCache
instance to be used byTypeFactory
.- Specified by:
forTypeFactory
in interfaceCacheProvider
- Returns:
LookupCache
instance for constructingTypeFactory
.
-
_buildCache
protected <K,V> LookupCache<K,V> _buildCache(int maxSize)
-
builder
public static DefaultCacheProvider.Builder builder()
- Returns:
DefaultCacheProvider.Builder
instance for configuration.
-
-