CaffeineCache instead.public class LRUCache<K,V> extends SolrCacheBase implements SolrCache<K,V>, Accountable
| Modifier and Type | Class and Description |
|---|---|
static class |
LRUCache.CacheValue<V>
Deprecated.
|
SolrCacheBase.AutoWarmCountRefSolrCache.StateSolrInfoBean.Category, SolrInfoBean.Groupautowarm, regeneratorCLEANUP_THREAD_PARAM, EVICTIONS_PARAM, HIT_RATIO_PARAM, HITS_PARAM, INITIAL_SIZE_PARAM, INSERTS_PARAM, LOOKUPS_PARAM, MAX_IDLE_TIME_PARAM, MAX_RAM_MB_PARAM, MAX_SIZE_PARAM, RAM_BYTES_USED_PARAM, SHOW_ITEMS_PARAM, SIZE_PARAM| Constructor and Description |
|---|
LRUCache()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Deprecated.
:TODO: copy from Map
|
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction)
Deprecated.
Get an existing element or atomically compute it if missing.
|
V |
get(K key)
Deprecated.
:TODO: copy from Map
|
Collection<Accountable> |
getChildResources()
Deprecated.
|
String |
getDescription()
Deprecated.
Simple one or two line description
|
long |
getMaxRamBytes()
Deprecated.
|
int |
getMaxRamMB()
Deprecated.
Returns maximum size limit (in MB) if set and supported, -1 otherwise.
|
int |
getMaxSize()
Deprecated.
Returns maximum size limit (number of items) if set and supported, -1 otherwise.
|
Set<String> |
getMetricNames()
Deprecated.
Modifiable set of metric names that this component reports (default is null,
which means none).
|
String |
getName()
Deprecated.
Simple common usage name, e.g.
|
SolrMetricsContext |
getSolrMetricsContext()
Deprecated.
Implementing classes should override this method to provide the context obtained in
SolrMetricProducer.initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics
at the end of the life-cycle of this component. |
Object |
init(Map args,
Object persistence,
CacheRegenerator regenerator)
Deprecated.
The initialization routine.
|
void |
initializeMetrics(SolrMetricsContext parentContext,
String scope)
Deprecated.
Initialize metrics specific to this producer.
|
V |
put(K key,
V value)
Deprecated.
:TODO: copy from Map
|
V |
putCacheValue(K key,
LRUCache.CacheValue<V> cacheValue)
Deprecated.
Visible for testing to create synthetic cache entries.
|
long |
ramBytesUsed()
Deprecated.
|
V |
remove(K key)
Deprecated.
|
void |
setMaxRamMB(int maxRamMB)
Deprecated.
Set maximum size limit (in MB), or -1 for unlimited.
|
void |
setMaxSize(int maxSize)
Deprecated.
Set maximum size limit (number of items), or -1 for unlimited.
|
void |
setSyntheticEntries(boolean syntheticEntries)
Deprecated.
Visible for testing.
|
int |
size()
Deprecated.
:TODO: copy from Map
|
String |
toString()
Deprecated.
|
void |
warm(SolrIndexSearcher searcher,
SolrCache<K,V> old)
Deprecated.
Warm this cache associated with
searcher using the old
cache object. |
calcHitRatio, getAutowarmDescription, getCategory, getState, getVersion, init, isAutowarmingOn, name, setStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCategory, getMetricRegistry, getMetricsSnapshot, registerMetricNamegetUniqueMetricTag, initializeMetricspublic Object init(Map args, Object persistence, CacheRegenerator regenerator)
SolrCacheargs map.
The persistence object will exist across different lifetimes of similar caches. For example, all filter caches will share the same persistence object, sometimes at the same time (it must be thread-safe). If null is passed, then the cache implementation should create and return a new persistence object. If not null, the passed in object should be returned again.
Since it will exist across the lifetime of many caches, care should be taken to not reference any particular cache instance and prevent it from being garbage collected (no using inner classes unless they are static).
The persistence object is designed to be used as a way for statistics to accumulate across all instances of the same type of cache, however the object may be of any type desired by the cache implementation.
The CacheRegenerator is what the cache uses during auto-warming to
regenerate an item in the new cache from an entry in the old cache.
public void setSyntheticEntries(boolean syntheticEntries)
public long getMaxRamBytes()
public int size()
SolrCachepublic V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
SolrCachecomputeIfAbsent in interface SolrCache<K,V>key - keymappingFunction - function to compute the element. If the function returns a null
result the cache mapping will not be created. NOTE: this function
must NOT attempt to modify any mappings in the cache.public V put(K key, V value)
SolrCachepublic V putCacheValue(K key, LRUCache.CacheValue<V> cacheValue)
public V get(K key)
SolrCachepublic void clear()
SolrCachepublic void warm(SolrIndexSearcher searcher, SolrCache<K,V> old)
SolrCachesearcher using the old
cache object. this and old will have the same concrete type.public String getName()
SolrInfoBeangetName in interface SolrInfoBeanpublic String getDescription()
SolrInfoBeangetDescription in interface SolrInfoBeanpublic Set<String> getMetricNames()
SolrInfoBeanSolrInfoBean.registerMetricName(String)
to capture what metrics names are reported from this component.
NOTE: this set has to allow iteration under modifications.
getMetricNames in interface SolrInfoBeanpublic SolrMetricsContext getSolrMetricsContext()
SolrMetricProducerSolrMetricProducer.initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics
at the end of the life-cycle of this component.getSolrMetricsContext in interface SolrMetricProducerpublic void initializeMetrics(SolrMetricsContext parentContext, String scope)
SolrMetricProducerinitializeMetrics in interface SolrMetricProducerparentContext - parent metrics context. If this component has the same life-cycle as the parent
it can simply use the parent context, otherwise it should obtain a child context
using SolrMetricsContext.getChildContext(Object) passing this
as the child.scope - component scopepublic long ramBytesUsed()
ramBytesUsed in interface Accountablepublic Collection<Accountable> getChildResources()
getChildResources in interface Accountablepublic int getMaxSize()
SolrCachegetMaxSize in interface SolrCache<K,V>public void setMaxSize(int maxSize)
SolrCachesetMaxSize in interface SolrCache<K,V>public int getMaxRamMB()
SolrCachegetMaxRamMB in interface SolrCache<K,V>public void setMaxRamMB(int maxRamMB)
SolrCachesetMaxRamMB in interface SolrCache<K,V>Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.