cache

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
	ErrKeyExpired  = errors.New("key expired")
)

Functions

This section is empty.

Types

type Cache

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

func New

func New[T any](cfg Config) *Cache[T]

func (*Cache[T]) Cleanup added in v1.14.1

func (c *Cache[T]) Cleanup()

func (*Cache[T]) Drain

func (c *Cache[T]) Drain() map[string]T

func (*Cache[T]) Get added in v1.14.1

func (c *Cache[T]) Get(key string) (T, error)

func (*Cache[T]) Set

func (c *Cache[T]) Set(key string, value T) error

type Config added in v1.14.1

type Config struct {
	TTL time.Duration
}

Jump to

Keyboard shortcuts

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