cachettl

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cachettl resolves the cache TTL for a given route group, loaded once at startup from the CACHE_TTLS env var so slower-changing entities and faster-changing ones aren't forced onto the same cache policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config resolves a per-route-group TTL, falling back to a configured default for any route group without an explicit entry.

func Load

func Load() Config

Load parses CACHE_TTLS ("route=duration,route=duration", e.g. "licenses=30m,volumes=15m") and CACHE_DEFAULT_TTL (a single duration string) from the environment. Malformed entries are logged and skipped rather than failing startup.

func (Config) TTL

func (c Config) TTL(route string) time.Duration

TTL returns the configured TTL for the given route group, or the configured default if the route group has no explicit entry.

Jump to

Keyboard shortcuts

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