Skip to content

Commit

Permalink
Update IndicesRequestCache.java
Browse files Browse the repository at this point in the history
Signed-off-by: Kiran Prakash <[email protected]>
  • Loading branch information
kiranprakash154 committed Mar 29, 2024
1 parent 7dc03ba commit 268797f
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ public final class IndicesRequestCache implements RemovalListener<IndicesRequest
* A setting to enable or disable request caching on an index level. Its dynamic by default
* since we are checking on the cluster state IndexMetadata always.
*/
public static final String SETTING_INDICES_REQUEST_CACHE_STALENESS_THRESHOLD_SETTING =
"indices.requests.cache.cleanup.staleness_threshold";
public static final String SETTING_INDICES_REQUEST_CACHE_CLEAN_INTERVAL_SETTING = "indices.requests.cache.cleanup.interval";

public static final Setting<Boolean> INDEX_CACHE_REQUEST_ENABLED_SETTING = Setting.boolSetting(
"index.requests.cache.enable",
true,
Expand All @@ -125,12 +129,12 @@ public final class IndicesRequestCache implements RemovalListener<IndicesRequest
Property.NodeScope
);
public static final Setting<TimeValue> INDICES_REQUEST_CACHE_CLEAN_INTERVAL_SETTING = Setting.positiveTimeSetting(
"indices.requests.cache.cleanup.interval",
SETTING_INDICES_REQUEST_CACHE_CLEAN_INTERVAL_SETTING,
INDICES_CACHE_CLEAN_INTERVAL_SETTING,
Property.NodeScope
);
public static final Setting<String> INDICES_REQUEST_CACHE_STALENESS_THRESHOLD_SETTING = new Setting<>(
"indices.requests.cache.cleanup.staleness_threshold",
SETTING_INDICES_REQUEST_CACHE_STALENESS_THRESHOLD_SETTING,
"0%",
IndicesRequestCache::validateStalenessSetting,
Property.Dynamic,
Expand Down Expand Up @@ -452,7 +456,7 @@ class IndicesRequestCacheCleanupManager implements Closeable {
private final Set<CleanupKey> keysToClean;
private final ConcurrentMap<ShardId, HashMap<String, Integer>> cleanupKeyToCountMap;
private final AtomicInteger staleKeysCount;
private double stalenessThreshold;
private volatile double stalenessThreshold;
private final IndicesRequestCacheCleaner cacheCleaner;

IndicesRequestCacheCleanupManager(ThreadPool threadpool, TimeValue cleanInterval, double stalenessThreshold) {
Expand Down

0 comments on commit 268797f

Please sign in to comment.