public final class UsageTrackingQueryCachingPolicy extends Object implements QueryCachingPolicy
QueryCachingPolicy that tracks usage statistics of recently-used
filters in order to decide on which filters are worth caching.ALWAYS_CACHE| Constructor and Description |
|---|
UsageTrackingQueryCachingPolicy()
Create a new instance with an history size of 256.
|
UsageTrackingQueryCachingPolicy(int historySize)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
minFrequencyToCache(Query query)
For a given query, return how many times it should appear in the history
before being cached.
|
void |
onUse(Query query)
Callback that is called every time that a cached filter is used.
|
boolean |
shouldCache(Query query)
Whether the given
Query is worth caching. |
public UsageTrackingQueryCachingPolicy(int historySize)
historySize - the number of recently used filters to trackpublic UsageTrackingQueryCachingPolicy()
protected int minFrequencyToCache(Query query)
public void onUse(Query query)
QueryCachingPolicyonUse in interface QueryCachingPolicypublic boolean shouldCache(Query query) throws IOException
QueryCachingPolicyQuery is worth caching.
This method will be called by the QueryCache to know whether to
cache. It will first attempt to load a DocIdSet from the cache.
If it is not cached yet and this method returns true then a
cache entry will be generated. Otherwise an uncached scorer will be
returned.shouldCache in interface QueryCachingPolicyIOExceptionCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.