cache

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func New

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

New creates the new Cache instance

func (*Cache[K, V]) SetCompareFn

func (c *Cache[K, V]) SetCompareFn(compareFn CompareFn[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

Jump to

Keyboard shortcuts

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