cache

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMCompiles,
	WASMJS:           packageprops.WASMCompiles,
	WASMFreestanding: packageprops.WASMCompiles,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `wasmsurvey props generate`; curate by hand, then `wasmsurvey props verify`.

Functions

This section is empty.

Types

type CHCache

type CHCache struct {
	// contains filtered or unexported fields
}

CHCache implements CompiledQueryCache using a ClickHouse MergeTree table for persistence and an in-memory map for fast reads. The table is created automatically on first use.

The cache is keyed by the template hash (the cache_key). Writes go to both the in-memory map and ClickHouse. Reads hit memory first, falling back to ClickHouse on miss (cold start after proxy restart).

Usage:

cache := orchestrator.NewCHCache(chClient, "default", "compiled_query_cache")
err := cache.Init(ctx)

func NewCHCache

func NewCHCache(ch orchestrator.CHClientI, database, table string) *CHCache

NewCHCache creates a ClickHouse-backed cache.

func (*CHCache) Get

func (inst *CHCache) Get(key string) (entry *orchestrator.CacheEntry, found bool)

Get retrieves a cache entry by key. Checks memory first, then ClickHouse.

func (*CHCache) Init

func (inst *CHCache) Init(ctx context.Context) error

Init creates the cache table if it doesn't exist and loads existing entries into the in-memory map. Must be called before Get/Put.

func (*CHCache) Put

func (inst *CHCache) Put(key string, entry *orchestrator.CacheEntry)

Put stores or invalidates a cache entry. A nil entry invalidates the key.

Jump to

Keyboard shortcuts

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