openfromenv

package
v0.1.0-alpha.138 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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