SOLR-13817: Deprecate legacy SolrCache implementations.

This commit is contained in:
Andrzej Bialecki 2019-11-14 18:30:38 +01:00
parent e5f2b2380b
commit 6e655a99ce
6 changed files with 12 additions and 1 deletions

View File

@ -34,6 +34,9 @@ Upgrade Notes
* org.apache.solr.search.grouping.distributed.command.QueryCommand.Builder has new method 'setMainQuery' which is used
to set top-level query. build() would fail if called without setting mainQuery
* SOLR-13817: Deprecate legacy SolrCache implementations. Users are encouraged to transition their
configurations to use org.apache.solr.search.CaffeineCache instead.
New Features
---------------------

View File

@ -124,7 +124,7 @@ public class CacheConfig implements MapSerializable{
SolrResourceLoader loader = solrConfig.getResourceLoader();
config.cacheImpl = config.args.get("class");
if(config.cacheImpl == null) config.cacheImpl = "solr.LRUCache";
if (config.cacheImpl == null) config.cacheImpl = "solr.CaffeineCache";
config.regenImpl = config.args.get("regenerator");
config.clazz = loader.findClass(config.cacheImpl, SolrCache.class);
if (config.regenImpl != null) {

View File

@ -45,6 +45,8 @@ import org.slf4j.LoggerFactory;
* @see org.apache.solr.util.ConcurrentLRUCache
* @see org.apache.solr.search.SolrCache
* @since solr 1.4
* @deprecated This cache implementation is deprecated and will be removed in Solr 9.0.
* Use {@link CaffeineCache} instead.
*/
public class FastLRUCache<K, V> extends SolrCacheBase implements SolrCache<K, V>, Accountable {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

View File

@ -49,6 +49,8 @@ import static org.apache.solr.common.params.CommonParams.NAME;
* @see org.apache.solr.util.ConcurrentLFUCache
* @see org.apache.solr.search.SolrCache
* @since solr 3.6
* @deprecated This cache implementation is deprecated and will be removed in Solr 9.0.
* Use {@link CaffeineCache} instead.
*/
public class LFUCache<K, V> implements SolrCache<K, V>, Accountable {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

View File

@ -43,6 +43,8 @@ import static org.apache.lucene.util.RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_U
/**
*
* @deprecated This cache implementation is deprecated and will be removed in Solr 9.0.
* Use {@link CaffeineCache} instead.
*/
public class LRUCache<K,V> extends SolrCacheBase implements SolrCache<K,V>, Accountable {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

View File

@ -37,6 +37,8 @@ When a new searcher is opened, the current searcher continues servicing requests
In Solr, the following cache implementations are available: recommended `solr.search.CaffeineCache`, and legacy implementations: `solr.search.LRUCache`, `solr.search.FastLRUCache,` and `solr.search.LFUCache`.
NOTE: `LRUCache`, `LFUCache` and `FastLRUCache` are deprecated and will be removed in Solr 9.0. Users should switch their configurations to use `CaffeineCache` instead.
The `CaffeineCache` is an implementation backed by the https://github.com/ben-manes/caffeine[Caffeine caching library]. By default it uses a Window TinyLFU (W-TinyLFU) eviction policy, which allows the eviction based on both frequency and recency of use in O(1) time with a small footprint. Generally this cache implementation is recommended over other legacy caches as it usually offers lower memory footprint, higher hit ratio and better multi-threaded performance over legacy caches.
The acronym LRU stands for Least Recently Used. When an LRU cache fills up, the entry with the oldest last-accessed timestamp is evicted to make room for the new entry. The net effect is that entries that are accessed frequently tend to stay in the cache, while those that are not accessed frequently tend to drop out and will be re-fetched from the index if needed again.