cache

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 0 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 comparable, V any] interface {
	Purge()
	Add(key K, value V) (updated, evicted bool)
	Get(key K) (value V, ok bool)
	Contains(key K) bool
	Peek(key K) (value V, ok bool)
	ContainsOrAdd(key K, value V) (ok, evicted bool)
	Remove(key K)
	RemoveOldest()
	Keys() []K
	Len() int
}

func NewNoCache

func NewNoCache[K comparable, V any]() Cache[K, V]

type NoCache

type NoCache[K comparable, V any] struct{}

func (*NoCache[K, V]) Add

func (n *NoCache[K, V]) Add(_ K, _ V) (updated, evicted bool)

func (*NoCache[K, V]) Contains

func (n *NoCache[K, V]) Contains(_ K) bool

func (*NoCache[K, V]) ContainsOrAdd

func (n *NoCache[K, V]) ContainsOrAdd(key K, value V) (ok, evicted bool)

func (*NoCache[K, V]) Get

func (n *NoCache[K, V]) Get(_ K) (value V, ok bool)

func (*NoCache[K, V]) Keys

func (n *NoCache[K, V]) Keys() []K

func (*NoCache[K, V]) Len

func (n *NoCache[K, V]) Len() int

func (*NoCache[K, V]) Peek

func (n *NoCache[K, V]) Peek(_ K) (value V, ok bool)

func (*NoCache[K, V]) Purge

func (n *NoCache[K, V]) Purge()

func (*NoCache[K, V]) Remove

func (n *NoCache[K, V]) Remove(key K)

func (*NoCache[K, V]) RemoveOldest

func (n *NoCache[K, V]) RemoveOldest()

Directories

Path Synopsis
lru

Jump to

Keyboard shortcuts

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