cache

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFunction     = errors.New("not function")
	ErrInvalidFunction = errors.New("invalid function")
	DefaultValidKey    = 1
)

Functions

This section is empty.

Types

type ICProducer

type ICProducer func(interface{}, ...interface{}) (interface{}, error)

ICProducer defines formal producer: func(cached TypeA, args...) (value TypeA, error) Alternation: func(cached TypeA, args) (value TypeA) func(args) (value TypeA, error) func(args) (value TypeA)

func FormalizeChainedICProducer

func FormalizeChainedICProducer(f interface{}) ICProducer

func FormalizeICProducer

func FormalizeICProducer(f interface{}) ICProducer

func TryFormalizeChainedICProducer

func TryFormalizeChainedICProducer(f interface{}) (ICProducer, error)

func TryFormalizeICProducer

func TryFormalizeICProducer(f interface{}) (ICProducer, error)

type ICValidator

type ICValidator func(interface{}) bool

ICValidator defines formal validator: func(cached TypeA) (validity bool)

func FormalizeICValidator

func FormalizeICValidator(f interface{}) ICValidator

func TryFormalizeICValidator

func TryFormalizeICValidator(f interface{}) (ICValidator, error)

type InlineCache

type InlineCache struct {
	Producer  ICProducer
	Validator ICValidator
	// contains filtered or unexported fields
}

func (*InlineCache) Invalidate

func (c *InlineCache) Invalidate()

func (*InlineCache) Value

func (c *InlineCache) Value(args ...interface{}) interface{}

func (*InlineCache) ValueWithError

func (c *InlineCache) ValueWithError(args ...interface{}) (cached interface{}, err error)

Jump to

Keyboard shortcuts

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