java.lang.Object | |
↳ | com.atlassian.jira.util.cache.CompositeKeyCache<R, S, T> |
Cache of (R, S) -> T. Designed to be used for general mappings of things to a field in an index.
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); } } );
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A useful way to build the cche for testing as instrumentation requires the ComponentAccessor to be initialised.
| |||||||||||
This cache caches the first (R) reference weakly, the second (S) reference strongly and the
value (T) reference softly.
| |||||||||||
Get the thing mapped to this key for the specified reader.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object |
A useful way to build the cche for testing as instrumentation requires the ComponentAccessor to be initialised.
This cache caches the first (R) reference weakly, the second (S) reference strongly and the
value (T) reference softly. This is specifically designed for use with Lucene where the
IndexReader
is being recycled regularly (the R) and the terms (T) may be softly referenced.
cacheName | A Name to use when we instrument an instance of this cache. If null the cache will not be instrumented |
---|
Get the thing mapped to this key for the specified reader.
one | the first one |
---|---|
two | the second one |
supplier | to generate the value if not already there, only called if not already cached. |