public class IndicesRequestCache extends AbstractComponent implements com.google.common.cache.RemovalListener<IndicesRequestCache.Key,IndicesRequestCache.Value>
Currently, the cache is only enabled for count requests, and can only be opted in on an index level setting that can be dynamically changed and defaults to false.
There are still several TODOs left in this class, some easily addressable, some more complex, but the support is functional.
Modifier and Type | Class and Description |
---|---|
static class |
IndicesRequestCache.Key |
static class |
IndicesRequestCache.Value |
Modifier and Type | Field and Description |
---|---|
static String |
DEPRECATED_INDEX_CACHE_REQUEST_ENABLED
Deprecated.
|
static String |
DEPRECATED_INDICES_CACHE_QUERY_SIZE
Deprecated.
|
static String |
INDEX_CACHE_REQUEST_ENABLED
A setting to enable or disable request caching on an index level.
|
static String |
INDICES_CACHE_QUERY_CONCURRENCY_LEVEL |
static String |
INDICES_CACHE_QUERY_EXPIRE |
static String |
INDICES_CACHE_QUERY_SIZE |
static String |
INDICES_CACHE_REQUEST_CLEAN_INTERVAL |
deprecationLogger, logger, settings
Constructor and Description |
---|
IndicesRequestCache(Settings settings,
ClusterService clusterService,
ThreadPool threadPool) |
Modifier and Type | Method and Description |
---|---|
boolean |
canCache(ShardSearchRequest request,
SearchContext context)
Can the shard request be cached at all?
|
void |
clear(IndexShard shard) |
void |
close() |
void |
loadIntoContext(ShardSearchRequest request,
SearchContext context,
QueryPhase queryPhase)
Loads the cache result, computing it if needed by executing the query phase and otherwise deserializing the cached
value into the
context's query result . |
void |
onRemoval(com.google.common.cache.RemovalNotification<IndicesRequestCache.Key,IndicesRequestCache.Value> notification) |
logDeprecatedSetting, logRemovedSetting, nodeName
public static final String INDEX_CACHE_REQUEST_ENABLED
@Deprecated public static final String DEPRECATED_INDEX_CACHE_REQUEST_ENABLED
public static final String INDICES_CACHE_REQUEST_CLEAN_INTERVAL
public static final String INDICES_CACHE_QUERY_SIZE
@Deprecated public static final String DEPRECATED_INDICES_CACHE_QUERY_SIZE
public static final String INDICES_CACHE_QUERY_EXPIRE
public static final String INDICES_CACHE_QUERY_CONCURRENCY_LEVEL
@Inject public IndicesRequestCache(Settings settings, ClusterService clusterService, ThreadPool threadPool)
public void close()
public void clear(IndexShard shard)
public void onRemoval(com.google.common.cache.RemovalNotification<IndicesRequestCache.Key,IndicesRequestCache.Value> notification)
onRemoval
in interface com.google.common.cache.RemovalListener<IndicesRequestCache.Key,IndicesRequestCache.Value>
public boolean canCache(ShardSearchRequest request, SearchContext context)
public void loadIntoContext(ShardSearchRequest request, SearchContext context, QueryPhase queryPhase) throws Exception
context's query result
. The combination of load + compute allows
to have a single load operation that will cause other requests with the same key to wait till its loaded an reuse
the same cache.Exception
Copyright © 2009–2016. All rights reserved.