openfromenv

package
v0.1.0-alpha.58 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package openfromenv provides the supported cache constructor: a bounded in-process L1, an optional Redis L2 when GOBEYOND_CACHE_* is set, and the tag-bump watcher that drops local copies early when L2 is present.

It lives in a subpackage so cache can keep its Store interface free of an import cycle with cache/memstore and cache/redisstore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(opts Options) (config *cache.RuntimeConfig, closeFn func() error, err error)

Open is OpenFromEnv with explicit options (tests, custom logger).

func OpenFromEnv

func OpenFromEnv() (config *cache.RuntimeConfig, close func() error, err error)

OpenFromEnv builds the deployment cache assembly:

  1. bounded memstore L1 (default MaxEntries/MaxBytes/MaxTTL)
  2. redisstore.FromEnv — absent endpoint is success (L1-only)
  3. cache.Tiered(l1, l2)
  4. WatchTagBumps when L2 is present

The returned RuntimeConfig is ready for runtime.Config.Cache (BuildID is filled by runtime.New). Close cancels the tag-bump watcher and closes the Redis client when one was opened; it is safe to call more than once.

Types

type Options

type Options struct {
	// Logger receives tiered-store warnings. slog.Default applies when nil.
	Logger *slog.Logger
	// Memstore overrides L1 bounds. The zero value uses memstore defaults.
	Memstore memstore.Options
	// Redis overrides redisstore.FromEnv fields. The zero value reads the
	// GOBEYOND_CACHE_* environment entirely.
	Redis redisstore.Options
}

Options configures Open. The zero value is the supported deployment default.

Jump to

Keyboard shortcuts

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