Documentation
¶
Overview ¶
Package cloudrun provides automatic persistence backend selection for Cloud Run. Detects Cloud Run via K_SERVICE env var and tries Datastore first, falling back to local files if unavailable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store[K comparable, V any] interface { ValidateKey(key K) error Get(ctx context.Context, key K) (V, time.Time, bool, error) Set(ctx context.Context, key K, value V, expiry time.Time) error Delete(ctx context.Context, key K) error Cleanup(ctx context.Context, maxAge time.Duration) (int, error) Flush(ctx context.Context) (int, error) Len(ctx context.Context) (int, error) Close() error }
Store is the persistence interface returned by New. Matches fido.Store so callers can pass it to fido.NewTiered.
func New ¶
func New[K comparable, V any](ctx context.Context, cacheID string, c ...compress.Compressor) (Store[K, V], error)
New creates a persistence layer for Cloud Run environments. In Cloud Run: tries Datastore, falls back to local files on error. Outside Cloud Run: uses local files directly. Optional compressor enables compression (e.g., compress.S2() for Snappy-compatible).
Click to show internal directories.
Click to hide internal directories.