cache

package
v0.4.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMetrics added in v0.3.2

func RegisterMetrics(namespace string)

Types

type Cache

type Cache[K, V comparable] struct {
	// contains filtered or unexported fields
}

func New

func New[K, V comparable](size int, opts ...Option[K, V]) (*Cache[K, V], error)

New creates the new Cache instance

func (*Cache[K, V]) Patch added in v0.3.2

func (c *Cache[K, V]) Patch(opt Option[K, V])

func (*Cache[K, V]) UpdateCacheValue

func (c *Cache[K, V]) UpdateCacheValue(key K, newVal V) (updated bool)

UpdateCacheValue returns true if nev value updated in cache.

type CompareFn

type CompareFn[V comparable] func(cacheVal, newVal V) bool

type Option added in v0.3.2

type Option[K, V comparable] func(*Cache[K, V])

func WithCompareFunc added in v0.3.2

func WithCompareFunc[K, V comparable](compareFn CompareFn[V]) Option[K, V]

func WithMetrics added in v0.3.2

func WithMetrics[K, V comparable](instanceName string) Option[K, V]

Jump to

Keyboard shortcuts

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