cache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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