cache

package
v0.0.0-...-df9fb1a Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DurationMinimum time.Duration = 1 * time.Minute
)

Variables

View Source
var (
	GlobalCache       = make(Cache)
	CleanTicker       *time.Ticker
	Cancel            chan struct{}
	ErrExpiryTooShort = fmt.Errorf("expiry too short - minimum %v minutes", DurationMinimum.Minutes())
	ErrNotInCache     = errors.New("not in cache")
)

Functions

This section is empty.

Types

type Cache

type Cache map[string]CacheItem

func (Cache) Add

func (c Cache) Add(path string, content interface{}, expires time.Time) error

func (Cache) Clean

func (c Cache) Clean()

func (Cache) Get

func (c Cache) Get(path string) (interface{}, error)

func (Cache) Invalidate

func (c Cache) Invalidate(path string)

type CacheItem

type CacheItem struct {
	Expires time.Time
	Content interface{}
}

func (*CacheItem) Valid

func (ci *CacheItem) Valid() bool

Jump to

Keyboard shortcuts

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