UsageTrackingQueryCachingPolicy

open class UsageTrackingQueryCachingPolicy(historySize: Int = 256) : QueryCachingPolicy

A QueryCachingPolicy that tracks usage statistics of recently-used filters in order to decide on which filters are worth caching.

Constructors

Link copied to clipboard
constructor(historySize: Int = 256)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun frequency(query: Query): Int
Link copied to clipboard
open override fun 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.

Link copied to clipboard
open override fun shouldCache(query: Query): Boolean

Whether the given Query is worth caching. This method will be called by the [ ] 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.