Class SerializerCache

java.lang.Object
tools.jackson.databind.ser.SerializerCache
All Implemented Interfaces:
Serializable, Snapshottable<SerializerCache>

public final class SerializerCache extends Object implements Snapshottable<SerializerCache>, Serializable
Simple cache object that allows for doing 2-level lookups: first level is by "local" read-only lookup Map (used without locking) and second backup level is by a shared modifiable HashMap. The idea is that after a while, most serializers are found from the local Map (to optimize performance, reduce lock contention), but that during buildup we can use a shared map to reduce both number of distinct read-only maps constructed, and number of serializers constructed.

Cache contains three kinds of entries, based on combination of class pair key. First class in key is for the type to serialize, and second one is type used for determining how to resolve value type. One (but not both) of entries can be null.

See Also:
  • Field Details

    • DEFAULT_MAX_CACHE_SIZE

      public static final int DEFAULT_MAX_CACHE_SIZE
      By default, allow caching of up to 4000 serializer entries (for possibly up to 1000 types; but depending access patterns may be as few as half of that).
      See Also:
  • Constructor Details

  • Method Details