Documentation
¶
Overview ¶
Package valkey backs clicky's cache.Store (and cache.Browser) with a valkey/redis server. It lives in a separate Go module so the valkey-go dependency stays out of the root clicky module: callers that only need the in-process stores (cache.NewMemory) never pull it in.
NewStore returns a cache.Store adapter over a valkey.Client; the domain stores compose over it, e.g. prompt.NewStore(valkey.NewStore(client), cfg) and metrics.NewStore(valkey.NewStore(client), cfg). One adapter (and one client) can back the prompt store, the metrics store, and the cache browser at once.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBrowser ¶
func NewBrowser(client valkey.Client, cfg BrowserConfig) cache.Browser
NewBrowser returns a cache.Browser over client. The client is owned by the caller (NewBrowser does not close it), so an app can share its existing connection.
Types ¶
type BrowserConfig ¶
type BrowserConfig struct {
// KeyPrefix is the physical namespace shared with the rest of the app
// (the same prefix the cache writes with). It is stripped from every key
// the browser returns and re-applied on lookups, so the API speaks
// logical keys only.
KeyPrefix string
// Separator splits keys into tree segments. Default ":".
Separator string
// MaxScan caps the number of keys a single tree/search/stats request
// scans. Default 100000.
MaxScan int
// MaxChildren caps the number of nodes returned per tree level. Default
// 1000.
MaxChildren int
// MaxValueBytes caps the string value returned by Key. Default 256KiB.
MaxValueBytes int
// MaxItems caps the collection items returned by Key. Default 1000.
MaxItems int
// OpTimeout bounds a whole browser request. Scans over large keyspaces
// take longer than single-key ops, so this is deliberately more generous
// than the timeseries opTimeout. Default 10s.
OpTimeout time.Duration
}
BrowserConfig tunes the valkey-backed cache.Browser.