cache

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OperationADD   = "add"
	OperationGET   = "get"
	OperationDEL   = "del"
	OperationEVICT = "evict"
)

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	Operations *prometheus.CounterVec
	Hits       prometheus.Counter
	Misses     prometheus.Counter
	Len        prometheus.Gauge
}

func NewMetrics

func NewMetrics(name, namespace string) Metrics

func (Metrics) ObserveHit

func (m Metrics) ObserveHit()

func (Metrics) ObserveLen

func (m Metrics) ObserveLen(n int)

func (Metrics) ObserveMiss

func (m Metrics) ObserveMiss()

func (Metrics) ObserveOperations

func (m Metrics) ObserveOperations(opType string, n int)

func (Metrics) Register

func (m Metrics) Register()

type TTLMap

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

func NewTTLMap

func NewTTLMap(maxItems int, name, namespace string) (m *TTLMap)

NewTTLMap returns a new TTLMap.

func (*TTLMap) Add

func (m *TTLMap) Add(k string, v interface{}, expiresAt time.Time, invincible bool)

func (*TTLMap) Delete

func (m *TTLMap) Delete(k string)

func (*TTLMap) EnableMetrics

func (m *TTLMap) EnableMetrics(namespace string)

func (*TTLMap) Get

func (m *TTLMap) Get(k string) (interface{}, time.Time, error)

func (*TTLMap) Len

func (m *TTLMap) Len() int

func (*TTLMap) OnItemAdded

func (m *TTLMap) OnItemAdded(f func(string, interface{}, time.Time))

func (*TTLMap) OnItemDeleted

func (m *TTLMap) OnItemDeleted(f func(string, interface{}, time.Time))

Jump to

Keyboard shortcuts

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