Class DefaultCacheProvider
java.lang.Object
com.fasterxml.jackson.databind.cfg.DefaultCacheProvider
- All Implemented Interfaces:
CacheProvider
,Serializable
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder offering fluent factory methods to configureDefaultCacheProvider
, keeping it immutable. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
Maximum size of theLookupCache
instance constructed byforDeserializerCache(DeserializationConfig)
.protected final int
Maximum size of theLookupCache
instance constructed byforSerializerCache(SerializationConfig)
protected final int
Maximum size of theLookupCache
instance constructed byforTypeFactory()
. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DefaultCacheProvider
(int maxDeserializerCacheSize, int maxSerializerCacheSize, int maxTypeFactoryCacheSize) -
Method Summary
Modifier and TypeMethodDescriptionprotected <K,
V> LookupCache <K, V> _buildCache
(int maxSize) static DefaultCacheProvider.Builder
builder()
static CacheProvider
Method to provide aLookupCache
instance for constructingDeserializerCache
.Method for constructing aLookupCache
instance to be used bySerializerCache
.Method for constructing aLookupCache
instance to be used byTypeFactory
.
-
Field Details
-
_maxDeserializerCacheSize
protected final int _maxDeserializerCacheSizeMaximum size of theLookupCache
instance constructed byforDeserializerCache(DeserializationConfig)
.- See Also:
-
_maxSerializerCacheSize
protected final int _maxSerializerCacheSizeMaximum size of theLookupCache
instance constructed byforSerializerCache(SerializationConfig)
- See Also:
-
_maxTypeFactoryCacheSize
protected final int _maxTypeFactoryCacheSizeMaximum size of theLookupCache
instance constructed byforTypeFactory()
.- See Also:
-
-
Constructor Details
-
DefaultCacheProvider
protected DefaultCacheProvider(int maxDeserializerCacheSize, int maxSerializerCacheSize, int maxTypeFactoryCacheSize)
-
-
Method Details
-
defaultInstance
- Returns:
- Default
DefaultCacheProvider
instance using default configuration values.
-
forDeserializerCache
public LookupCache<JavaType,JsonDeserializer<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
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
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
-
builder
- Returns:
DefaultCacheProvider.Builder
instance for configuration.
-