memoize

package
v0.1.32 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Memoize

func Memoize[F any](f F, options ...Option) F

Types

type MemoMetrics added in v0.1.14

type MemoMetrics struct {
	Hits       atomic.Int64
	Misses     atomic.Int64
	Evictions  atomic.Int64
	TotalItems int
}

type MetricsCollector added in v0.1.17

type MetricsCollector interface {
	Setup(function interface{})
	Collect(metrics *MemoMetrics)
}

type Option added in v0.1.14

type Option func(*memoizeOptions)

func WithExpiration

func WithExpiration(d time.Duration) Option

func WithIgnoreParams added in v0.1.23

func WithIgnoreParams(indices []int) Option

func WithMaxSize

func WithMaxSize(size int) Option

func WithMetrics added in v0.1.17

func WithMetrics(collector MetricsCollector) Option

type PrometheusMetricsCollector added in v0.1.17

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

func NewPrometheusMetricsCollector added in v0.1.17

func NewPrometheusMetricsCollector(labels ...string) *PrometheusMetricsCollector

func (*PrometheusMetricsCollector) Collect added in v0.1.17

func (p *PrometheusMetricsCollector) Collect(metrics *MemoMetrics)

func (*PrometheusMetricsCollector) Setup added in v0.1.17

func (p *PrometheusMetricsCollector) Setup(function interface{})

Jump to

Keyboard shortcuts

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