buffer

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewARCBuffer

func NewARCBuffer[K BufferKey](size int) func(generator func(K) any) Buffer[K]

func NewLFUBuffer

func NewLFUBuffer[K BufferKey](size int) func(generator func(K) any) Buffer[K]

func NewLRUBuffer

func NewLRUBuffer[K BufferKey](size int) func(generator func(K) any) Buffer[K]

func NewUnlimitedBuffer

func NewUnlimitedBuffer[K BufferKey]() func(generator func(K) any) Buffer[K]

Types

type ARCBuffer

type ARCBuffer[K BufferKey] struct {
	// contains filtered or unexported fields
}

func (ARCBuffer[K]) GetOrInsert

func (b ARCBuffer[K]) GetOrInsert(key K) (any, bool)

type Buffer

type Buffer[K BufferKey] interface {
	GetOrInsert(K) (any, bool)
}

type BufferKey

type BufferKey interface {
	~string | ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64
}

type LFUBuffer

type LFUBuffer[K BufferKey] struct {
	// contains filtered or unexported fields
}

func (LFUBuffer[K]) GetOrInsert

func (b LFUBuffer[K]) GetOrInsert(key K) (any, bool)

type LRUBuffer

type LRUBuffer[K BufferKey] struct {
	// contains filtered or unexported fields
}

func (LRUBuffer[K]) GetOrInsert

func (b LRUBuffer[K]) GetOrInsert(key K) (any, bool)

type UnlimitedBuffer

type UnlimitedBuffer[K BufferKey] struct {
	// contains filtered or unexported fields
}

func (UnlimitedBuffer[K]) GetOrInsert

func (b UnlimitedBuffer[K]) GetOrInsert(key K) (any, bool)

Jump to

Keyboard shortcuts

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