cache

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 3 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](size int, ttl time.Duration, load func(id string) (T, error)) (*Cache[T], error)

func (*Cache[T]) Load

func (c *Cache[T]) Load(id string) (T, error)

type TTLCell

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

func NewTTLCell

func NewTTLCell[T any](
	id string,
	ttl time.Duration,
	load func(id string) (T, error),
) *TTLCell[T]

func (*TTLCell[T]) Load

func (c *TTLCell[T]) Load() (T, error)

Jump to

Keyboard shortcuts

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