lrulist

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InsertStrategy

type InsertStrategy int
const (
	InsertFront InsertStrategy = iota
	InsertAverage
)

type LruList

type LruList struct {
	// contains filtered or unexported fields
}

func New

func New(updateInterval time.Duration, insertStrategy InsertStrategy) *LruList

func NewWithList

func NewWithList(updateInterval time.Duration, insertStrategy InsertStrategy, list []interface{}) *LruList

func (*LruList) Close

func (l *LruList) Close() (err error)

func (*LruList) DestroyListCopy

func (l *LruList) DestroyListCopy(list []*Node)

DestroyListCopy should be called when the list copy is no longer used

func (*LruList) GetListCopy

func (l *LruList) GetListCopy() []*Node

GetListCopy should be called when you want to traverse the list

func (*LruList) Insert

func (l *LruList) Insert(vals []interface{}) []*Node

Insert costs O(n+m) time

func (*LruList) Promote

func (l *LruList) Promote(node *Node)

Promote promotes node but lazy sort. O(1)

func (*LruList) Remove

func (l *LruList) Remove(node *Node)

O(n) scan to remove a node

type Node

type Node struct {
	Val interface{}
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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