longtermcache

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 1 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[K comparable, T any] struct {
	Make func(K) *T
	// contains filtered or unexported fields
}

func (*Cache[K, T]) Discard

func (c *Cache[K, T]) Discard(key K)

func (*Cache[K, T]) Lookup

func (c *Cache[K, T]) Lookup(key K, pol Policy) *T

type Policy

type Policy int
const (
	Available Policy = iota // Available accepts a stale value if available
	Fresh                   // Fresh insists on waiting for the latest value if update is running
	UpdateNow               // UpdateNow initiates an update
)

func (Policy) String

func (v Policy) String() string

Jump to

Keyboard shortcuts

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