R - the first key, usually a string. Must be a type that can be used as a map key (ie. immutable with correct equals/hashcode).S - the field name, usually a string. Must be a type that can be used as a map key (ie. immutable with correct equals/hashcode).T - the result thing.public class CompositeKeyCache<R,S,T> extends Object
Usage:
CompositeKeyCache<IndexReader, String, Collection<String>[]> cache = CompositeKeyCache.createWeakFirstKeySoftValueCache();
cache.get(reader, fieldName,
new Supplier<Collection<String>[]>()
{
public Collection<String>[] get()
{
return doStuff(reader, fieldName);
}
}
);
| Modifier and Type | Method and Description |
|---|---|
static <R,S,T> CompositeKeyCache<R,S,T> |
createWeakFirstKeySoftValueCache()
Deprecated.
@since v5.2 please supply a name so we can instrument this cache.
|
static <R,S,T> CompositeKeyCache<R,S,T> |
createWeakFirstKeySoftValueCache(String cacheName)
This cache caches the first (R) reference weakly, the second (S) reference strongly and the
value (T) reference softly.
|
T |
get(R one,
S two,
Supplier<T> supplier)
Get the thing mapped to this key for the specified reader.
|
public static <R,S,T> CompositeKeyCache<R,S,T> createWeakFirstKeySoftValueCache(String cacheName)
IndexReader is being recycled regularly (the R) and the terms (T) may be softly referenced.R - the first key typeS - the second key typeT - the value typecacheName - A Name to use when we instrument an instance of this cache. If null the cache will not be instrumented@Deprecated public static <R,S,T> CompositeKeyCache<R,S,T> createWeakFirstKeySoftValueCache()
Copyright © 2002-2021 Atlassian. All Rights Reserved.