QueryCache

lightdb.cache.QueryCache
trait QueryCache

QueryCache system to cache frequently used queries.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Types

type Doc <: Document[Doc]
type Key
type V

Value members

Abstract methods

protected def id(v: V): Id[Doc]

Concrete methods

def apply(key: Key, query: Query[Doc, Model, V]): Task[SearchResults[Doc, Model, V]]

Retrieve or start the search for query. If it's already in the map, we update its usage (increment reference count, update timestamp).

Retrieve or start the search for query. If it's already in the map, we update its usage (increment reference count, update timestamp).

Attributes

def clean(repeatEvery: Option[FiniteDuration]): Task[Unit]

Clean out expired entries, then remove entries if maxEntries is reached. Strategy for removal when exceeding maxEntries:

Clean out expired entries, then remove entries if maxEntries is reached. Strategy for removal when exceeding maxEntries:

  • Sort by reference count ascending, then by last-access time ascending, so that least-used and oldest get removed first.

Attributes

def clear(): Task[Unit]
protected def enabled: Boolean

If set to false, acts as just a pass-through. Defaults to true.

If set to false, acts as just a pass-through. Defaults to true.

Attributes

protected def maxEntries: Option[Int]

Maximum number of entries able to be cached before releasing. Defaults to 100.

Maximum number of entries able to be cached before releasing. Defaults to 100.

Attributes

def modify(key: Key, v: V): Task[Unit]

Updates all cached entries that contain the document with the same Key and Id as the provided value. The updated value replaces the old one while maintaining the original score.

Updates all cached entries that contain the document with the same Key and Id as the provided value. The updated value replaces the old one while maintaining the original score.

Value parameters

key

The key associated with the cache entries

v

The new value to update with

Attributes

protected def onlyFirstPage: Boolean

Whether to only cache the first page of queries. Defaults to true.

Whether to only cache the first page of queries. Defaults to true.

Attributes

protected def timeout: Option[FiniteDuration]

Cached results timeout. Defaults to 30 minutes.

Cached results timeout. Defaults to 30 minutes.

Attributes