cache

package
v0.0.0-...-3a0c414 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 15 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 NewCache

func NewCache[T any](name string, data T) *Cache[T]

func (*Cache[T]) ServeHTTP

func (c *Cache[T]) ServeHTTP() http.HandlerFunc

Handle a GET request to load data from the given cache

func (*Cache[T]) StartPeriodicUpdate

func (c *Cache[T]) StartPeriodicUpdate(updateFunc func() (T, error), interval time.Duration)

func (*Cache[T]) Update

func (c *Cache[T]) Update(data T)

Update the given cache

Jump to

Keyboard shortcuts

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