public class LRUTypeCache extends ResolvedTypeCache
ResolvedType instances. Uses "least-recently used" eviction algorithm
(via LinkedHashMap used internally) which optimized retention, but
requires full synchronization as read operation also has to modify internal state
to maintain LRU aspects.
This means that it works well in optimizing access patterns, by keeping most recently
accessed types in cache, but may not well work well for highly concurrent cases due
to synchronization overhead.
Like all ResolvedTypeCache implementations,
access is thread-safe and caller need not (and should not) use additional synchronization.
ConcurrentTypeCache,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected com.fasterxml.classmate.util.LRUTypeCache.CacheMap |
_map |
protected int |
_maxEntries |
| Constructor and Description |
|---|
LRUTypeCache(int maxEntries) |
| Modifier and Type | Method and Description |
|---|---|
ResolvedType |
find(ResolvedTypeKey key) |
void |
put(ResolvedTypeKey key,
ResolvedType type) |
int |
size() |
_addForTest, concurrentCache, key, key, lruCacheprotected final int _maxEntries
protected final transient com.fasterxml.classmate.util.LRUTypeCache.CacheMap _map
public ResolvedType find(ResolvedTypeKey key)
find in class ResolvedTypeCachepublic int size()
size in class ResolvedTypeCachepublic void put(ResolvedTypeKey key, ResolvedType type)
put in class ResolvedTypeCacheCopyright © 2025 fasterxml.com. All rights reserved.