cache

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BurrowStatsCounter added in v0.17.2

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

BurrowStatsCounter is a StatsCounter implementation for burrow cache. It is a wrapper around prometheus metrics. It has been intended to passed through the cache using cache.WithStatsCounter option - https://github.com/goburrow/cache/blob/f6da914dd6e3546dffa8802919dbca80cd33abe3/local.go#L552

func NewBurrowStatsCounter

func NewBurrowStatsCounter(logger log.Logger, reg prometheus.Registerer, name string, options ...Option) *BurrowStatsCounter

NewBurrowStatsCounter creates a new StatsCounter.

RecordLoadSuccess and RecordLoadError methods are called by Get methods on a successful and failed load respectively. Get method only called by LoadingCache implementation.

func (*BurrowStatsCounter) RecordEviction added in v0.17.2

func (c *BurrowStatsCounter) RecordEviction()

RecordEviction records the number of evictions. It is part of the burrow.StatsCounter interface.

func (*BurrowStatsCounter) RecordHits added in v0.17.2

func (c *BurrowStatsCounter) RecordHits(hits uint64)

RecordHits records the number of hits. It is part of the burrow.StatsCounter interface.

This method is called by Get and GetIfPresent methods on a cache hit.

func (*BurrowStatsCounter) RecordLoadError added in v0.17.2

func (c *BurrowStatsCounter) RecordLoadError(loadTime time.Duration)

RecordLoadError records the number of failed loads. It is part of the burrow.StatsCounter interface.

This method is called by Get methods on a failed load.

func (*BurrowStatsCounter) RecordLoadSuccess added in v0.17.2

func (c *BurrowStatsCounter) RecordLoadSuccess(loadTime time.Duration)

RecordLoadSuccess records the number of successful loads. It is part of the burrow.StatsCounter interface.

This method is called by Get methods on a successful load.

func (*BurrowStatsCounter) RecordMisses added in v0.17.2

func (c *BurrowStatsCounter) RecordMisses(misses uint64)

RecordMisses records the number of misses. It is part of the burrow.StatsCounter interface.

This method is called by Get and GetIfPresent methods method on a cache miss.

func (*BurrowStatsCounter) Snapshot added in v0.17.2

func (c *BurrowStatsCounter) Snapshot(s *burrow.Stats)

Snapshot records the current stats. It is part of the burrow.StatsCounter interface.

This method is called only by Stats method. And it is just for debugging purpose. Snapshot function is called manually and we don't plan to use it. For completeness, we implemented it.

func (*BurrowStatsCounter) Unregister added in v0.17.2

func (c *BurrowStatsCounter) Unregister() error

Unregister removes all metrics from the registry.

type Option

type Option func(c *BurrowStatsCounter)

Option add options for default Cache.

func WithTrackLoadingCacheStats

func WithTrackLoadingCacheStats() Option

WithTrackLoadingCacheStats enables tracking of loading cache stats. It is disabled by default.

Jump to

Keyboard shortcuts

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