cacheset

package
v1.31.9 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FetcherFunc

type FetcherFunc = func(key interface{}) (interface{}, error)

type Manager

type Manager struct {
	TTL time.Duration
	// contains filtered or unexported fields
}

func NewManager

func NewManager(ttl time.Duration) *Manager

func (*Manager) EvictSlotEntry

func (m *Manager) EvictSlotEntry(slot string, key interface{})

func (*Manager) FindSlot

func (m *Manager) FindSlot(slot string) *Slot

func (*Manager) RegisterSlot

func (m *Manager) RegisterSlot(name string, fetcher FetcherFunc, keyType interface{}) *Slot

RegisterSlot register a new cached "thing" this is only safe to called during init() and friends

func (*Manager) RunGCLoop

func (m *Manager) RunGCLoop()

type Slot

type Slot struct {
	// contains filtered or unexported fields
}

func (*Slot) Delete

func (s *Slot) Delete(key interface{})

func (*Slot) DeleteFunc

func (s *Slot) DeleteFunc(f func(key interface{}, value interface{}) bool) int

func (*Slot) Get

func (s *Slot) Get(key interface{}) (interface{}, error)

func (*Slot) GetCustomFetch

func (s *Slot) GetCustomFetch(key interface{}, fetcher FetcherFunc) (interface{}, error)

func (*Slot) Name

func (s *Slot) Name() string

func (*Slot) NewKey

func (s *Slot) NewKey() interface{}

Jump to

Keyboard shortcuts

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