- All Known Implementing Classes:
public interface QueryCachingPolicyA policy defining which filters should be cached.
Implementations of this class must be thread-safe.
- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
onUse(Query query)Callback that is called every time that a cached filter is used.
shouldCache(Query query)Whether the given
Queryis worth caching.
void onUse(Query query)Callback that is called every time that a cached filter is used. This is typically useful if the policy wants to track usage statistics in order to make decisions.
boolean shouldCache(Query query) throws IOExceptionWhether the given
Queryis worth caching. This method will be called by the
QueryCacheto know whether to cache. It will first attempt to load a
DocIdSetfrom the cache. If it is not cached yet and this method returns
truethen a cache entry will be generated. Otherwise an uncached scorer will be returned.