cache

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: BSD-3-Clause Imports: 4 Imported by: 1 module, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bloomfilter

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

func NewBloomFilter

func NewBloomFilter(limit int) *Bloomfilter

func (*Bloomfilter) Add

func (this *Bloomfilter) Add(key []byte)

func (*Bloomfilter) Contains

func (this *Bloomfilter) Contains(key []byte) bool

type LruCache

type LruCache[T any] struct {
	// contains filtered or unexported fields
}

func NewLruCache

func NewLruCache[T any](maxEntries int) *LruCache[T]

func (*LruCache[T]) Add

func (lc *LruCache[T]) Add(key lru.Key, value T)

Add adds a value to the cache. It uses Lock for exclusive writes.

func (*LruCache[T]) Get

func (lc *LruCache[T]) Get(key lru.Key) (value T, b bool)

Get retrieves a value from the cache. It uses RLock for concurrent reads.

func (*LruCache[T]) Remove

func (lc *LruCache[T]) Remove(key lru.Key)

Remove deletes an entry from the cache. It uses Lock for exclusive writes.

func (*LruCache[T]) RemoveMulti

func (lc *LruCache[T]) RemoveMulti(keys []string)

RemoveMulti deletes multiple entries from the cache. It uses Lock for exclusive writes.

Jump to

Keyboard shortcuts

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