cache

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// errors
	NotFound = "not found"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string
const (
	AddAction    Action = "add"
	DeleteAction Action = "delete"
	UpsertAction Action = "upsert"
)

type Cache

type Cache[T1 any] interface {
	Get(NSN) (T1, error)
	Add(context.Context, NSN, T1) error
	Upsert(context.Context, NSN, T1)
	Delete(context.Context, NSN)
	List() map[NSN]T1
	AddWatch(fn ResourceCallbackFn)
}

func New

func New[T1 any]() Cache[T1]

type CallbackFn

type CallbackFn func([]NSN, string)

type NSN

type NSN struct {
	Namespace string
	Name      string
}

func (NSN) String

func (r NSN) String() string

type ResourceCallbackFn

type ResourceCallbackFn func(context.Context, Action, NSN, any)

Jump to

Keyboard shortcuts

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