jscache

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "cache"

Name is the library identifier and the global binding installed into the runtime.

Variables

This section is empty.

Functions

func New

func New(store cache.Cache[any], opts ...Option) js.Lib

New builds the cache library over store. The caller picks the backing store — cache.NewMemory for single-node state, cache.NewRedis for shared state — and thereby its lifecycle and serialization. See WithKeyPrefix for namespacing the scripts' keys.

Types

type Option

type Option func(*libConfig)

Option customizes the cache library.

func WithKeyPrefix

func WithKeyPrefix(prefix string) Option

WithKeyPrefix prepends prefix to every key the scripts touch, sandboxing them into their own key namespace so host cache entries stay out of reach. The prefix is applied verbatim — include a separator (e.g. "js:") if one is wanted.

Jump to

Keyboard shortcuts

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