container

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Overview

Package container provides LRU cache implementation

Package container provides core container interfaces and implementations

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 {
	Put(K, V)
	Get(K) (V, bool)
	Delete(K)
	Len() int
	Evict(K)
}

Cache interface for size-bounded storage

type LRUCache

type LRUCache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

LRUCache implements least-recently-used cache

func NewLRUCache

func NewLRUCache[K comparable, V any](size int) *LRUCache[K, V]

func NewLRUCacheWithOnEvict

func NewLRUCacheWithOnEvict[K comparable, V any](size int, onEvict func(K, V)) *LRUCache[K, V]

func (*LRUCache[K, V]) Delete

func (c *LRUCache[K, V]) Delete(key K)

func (*LRUCache[K, V]) Evict

func (c *LRUCache[K, V]) Evict(key K)

func (*LRUCache[K, V]) Get

func (c *LRUCache[K, V]) Get(key K) (V, bool)

func (*LRUCache[K, V]) Len

func (c *LRUCache[K, V]) Len() int

func (*LRUCache[K, V]) Put

func (c *LRUCache[K, V]) Put(key K, value V)

type List

type List[T any] interface {
	Front() interface{}
	Back() interface{}
	PushFront(T)
	PushBack(T)
	Remove(interface{})
	Len() int
}

List interface for sequential data

type Map

type Map[K comparable, V any] interface {
	Put(K, V)
	Get(K) (V, bool)
	Delete(K)
	Len() int
	Oldest() (K, V, bool)
	Clear()
}

Map interface for key-value storage

Directories

Path Synopsis
iteratormock
Package iteratormock is a generated GoMock package.
Package iteratormock is a generated GoMock package.

Jump to

Keyboard shortcuts

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