cache

package
v1.0.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: ? 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

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