querycache

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package querycache is the engine's query cache, as a platform embedding the engine provides it: the cache it sets on an Invocation (Cache), the store that keeps its metadata (Store, checked by engine/querycachetest), and what they deal in. Each name is an alias of the engine's own, so a value passes between the two unchanged. See docs/designs/query-cache.md.

A platform turns the cache off for an invocation by setting no Cache on it.

Index

Constants

View Source
const (
	Ready        = cache.StateReady
	Incompatible = cache.StateIncompatible
	Unavailable  = cache.StateUnavailable
	Disabled     = cache.StateDisabled
)

The cache's states.

View Source
const (
	TagDataSource = cache.TagDataSource
	TagDataset    = cache.TagDataset
	TagModel      = cache.TagModel
)

The kinds of Tag: what a query read, which a clean selects its entries by.

View Source
const DefaultReadGrace = cache.DefaultReadGrace

DefaultReadGrace is how long after an entry expires a Manager keeps its file, unless its Config says otherwise: the longest a read of it can run, and a margin. A platform sweeping its store across tenants removes no entry expired for less.

View Source
const MaxDuration = cache.MaxDuration

MaxDuration is the longest a query may ask the cache to keep its result, and accept a cached one for.

Variables

View Source
var (
	// ErrNotPending is a Store's refusal to commit or abandon a write that
	// isn't pending.
	ErrNotPending = cache.ErrNotPending
	// ErrNoDataSourceIdentity is NewKey's refusal of a data source the host
	// gave no identity (DataSource.Identity): its queries run uncached.
	ErrNoDataSourceIdentity = cache.ErrNoDataSourceIdentity
)

Functions

func ValidNamespace

func ValidNamespace(ns string) bool

ValidNamespace reports whether ns can prefix a file's name in canal-lake.

Types

type Cache

type Cache = command.QueryCache

Cache is an invocation's query cache, set on an Invocation as QueryCache: its state for status, its settings, and its manager for a query. Nil: every query runs uncached, and status says nothing of one.

type Config

type Config = cache.Config

Config is a Manager's store, namespace and timings.

type Contents

type Contents = command.QueryCacheContents

Contents are what the cache holds, and where, as Cache.Contents answers for cache.status.

type Entry

type Entry = cache.Entry

Entry is one write of a query's result: a physical entry.

type EntryID

type EntryID = cache.EntryID

EntryID identifies an Entry, and orders writes.

type Expired

type Expired = cache.Expired

Expired is what a clean expired.

type Key

type Key = cache.Key

Key is a query's key in the cache.

func NewKey

func NewKey(in KeyInput) (Key, error)

NewKey is the key of the query in.

type KeyInput

type KeyInput = cache.KeyInput

KeyInput is what a key is made of (NewKey).

type Lake

type Lake = cache.Lake

Lake is what a Manager needs of canal-lake besides reading and writing entries: dropping their files.

type Manager

type Manager = cache.Manager

Manager is the cache's algorithm over a Store: lookups, writes, cleaning and sweeping. Cache.Manager gives one, made by NewManager.

func NewManager

func NewManager(c Config) (*Manager, error)

NewManager makes a Manager over c's store.

type Settings

type Settings = command.QueryCacheSettings

Settings are the cache's rules for a repo. A query's default cache.duration is the Invocation's QueryDefaults.CacheDuration.

type State

type State = cache.State

State is one of the cache's states (Ready, …).

type Store

type Store = cache.Store

Store keeps the cache's metadata. A platform may implement it on its own database; engine/querycachetest is what it must pass.

type StoreContents

type StoreContents = cache.Contents

StoreContents are what a store holds at a time: Contents without where.

type Summarizer

type Summarizer = cache.Summarizer

Summarizer reports the cache's state, as status does.

type Summary

type Summary = cache.Summary

Summary is the cache's state, as status reports it.

type Swept

type Swept = cache.Swept

Swept is what a Manager's sweep removed.

type Tag

type Tag = cache.Tag

Tag is what a clean selects entries by.

type TagKind

type TagKind = cache.TagKind

TagKind is what a Tag selects by.

type Write

type Write = cache.Write

Write is a write of a key's result in progress.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL