cache

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](ttl time.Duration) *Cache[T]

func (*Cache[T]) GetOrFetch

func (c *Cache[T]) GetOrFetch(ctx context.Context, fetch func(ctx context.Context) (T, error)) (T, error)

type ErrStale

type ErrStale struct {
	Err error
}

func (*ErrStale) Error

func (e *ErrStale) Error() string

func (*ErrStale) Unwrap

func (e *ErrStale) Unwrap() error

Jump to

Keyboard shortcuts

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