cache

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultTTL = 30 * time.Minute

DefaultTTL is how long a cache entry stays valid.

Variables

This section is empty.

Functions

func Age

func Age(name string) (time.Duration, bool)

Age returns the age of a cache entry and whether it exists.

func Clear

func Clear(name string) error

Clear removes a cache entry.

func ClearAll

func ClearAll() (int, error)

ClearAll removes every cache entry and reports how many were deleted.

func Load

func Load(name string, ttl time.Duration, v any) bool

Load reads a cache entry into v. It reports whether a fresh entry (younger than ttl) was found. Any read/parse problem is treated as a cache miss.

func Names

func Names() ([]string, error)

Names lists the entries currently stored in the cache directory.

func Save

func Save(name string, v any) error

Save writes v to the cache under the given name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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