ristretto

package
v1.154.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v1.143.0

type Cache interface {
	Get(key any) (any, bool)
	Set(key, value any, cost int64) bool
	SetWithTTL(key, value any, cost int64, ttl time.Duration) bool
	Del(key any)
	GetTTL(key any) (time.Duration, bool)
	Close()

	Hits() uint64
	Misses() uint64
}

Cache for ristretto.

func NewCache

func NewCache(params CacheParams) (Cache, error)

NewCache for ristretto.

type CacheParams added in v1.65.0

type CacheParams struct {
	fx.In

	Lifecycle fx.Lifecycle
	Config    *Config
	Version   version.Version
}

CacheParams for ristretto.

type Config

type Config struct {
	NumCounters int64 `yaml:"num_counters,omitempty" json:"num_counters,omitempty" toml:"num_counters,omitempty"`
	MaxCost     int64 `yaml:"max_cost,omitempty" json:"max_cost,omitempty" toml:"max_cost,omitempty"`
	BufferItems int64 `yaml:"buffer_items,omitempty" json:"buffer_items,omitempty" toml:"buffer_items,omitempty"`
}

Config for ristretto.

type NoopCache added in v1.143.0

type NoopCache struct{}

NoopCache for ristretto.

func NewNoopCache added in v1.143.0

func NewNoopCache() *NoopCache

NewNoopCache for ristretto.

func (*NoopCache) Close added in v1.143.0

func (*NoopCache) Close()

func (*NoopCache) Del added in v1.143.0

func (*NoopCache) Del(_ any)

func (*NoopCache) Get added in v1.143.0

func (*NoopCache) Get(_ any) (any, bool)

func (*NoopCache) GetTTL added in v1.143.0

func (*NoopCache) GetTTL(_ any) (time.Duration, bool)

func (*NoopCache) Hits added in v1.143.0

func (*NoopCache) Hits() uint64

func (*NoopCache) Misses added in v1.143.0

func (*NoopCache) Misses() uint64

func (*NoopCache) Set added in v1.143.0

func (*NoopCache) Set(_, _ any, _ int64) bool

func (*NoopCache) SetWithTTL added in v1.143.0

func (*NoopCache) SetWithTTL(_, _ any, _ int64, _ time.Duration) bool

Directories

Path Synopsis
telemetry

Jump to

Keyboard shortcuts

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