lfu

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LFU

type LFU[V any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LFU - Least Frequently Used cache

func New

func New[V any](size int) *LFU[V]

New LFU cache

func (*LFU[V]) Get

func (c *LFU[V]) Get(key string) V

Get an item from cache

func (*LFU[V]) Has

func (c *LFU[V]) Has(key string) bool

Has check if an item exists in cache, without useness update

func (*LFU[V]) Purge

func (c *LFU[V]) Purge()

Purge cache

func (*LFU[V]) Remove

func (c *LFU[V]) Remove(key string)

Remove an item from cache

func (*LFU[V]) Set

func (c *LFU[V]) Set(key string, value V)

Set an item to cache

Jump to

Keyboard shortcuts

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