cache

package
v0.0.0-...-9853328 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 2 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[T util.Comparable, R any] interface {
	Get(k T) *Entry[T, R]
	Put(k T, v R) *Entry[T, R]
	Cap() int
}

type Entry

type Entry[T util.Comparable, R any] interface {
	SetKey(k T)
	Key() T
	SetValue(v R)
	Value() R
	Free()
}

type IncEntry

type IncEntry[T util.Comparable, R any] interface {
	Entry[T, R]
}

type LFU

type LFU[T util.Comparable, R any] struct {
	// contains filtered or unexported fields
}

func NewLFU

func NewLFU[T util.Comparable, R any](cap int, newEntity func() Entry[T, R]) *LFU[T, R]

func (*LFU[T, R]) Cap

func (lfu *LFU[T, R]) Cap() int

type LRU

type LRU[T util.Comparable, R any] struct {
	// contains filtered or unexported fields
}

func NewLRU

func NewLRU[T util.Comparable, R any](cap int, newEntity func() Entry[T, R]) *LRU[T, R]

func (*LRU[T, R]) Cap

func (lru *LRU[T, R]) Cap() int

func (*LRU[T, R]) Get

func (lru *LRU[T, R]) Get(k T) *Entry[T, R]

func (*LRU[T, R]) Put

func (lru *LRU[T, R]) Put(k T, v R) *Entry[T, R]

Jump to

Keyboard shortcuts

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