lru

package
v1.2.117 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyLRU

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

KeyLRU takes advantage of list's sequence and map's efficient locate

func (*KeyLRU) Add

func (lru *KeyLRU) Add(key any) error

add adds Key to the head of the linked list.

func (*KeyLRU) AddOrUpdate

func (lru *KeyLRU) AddOrUpdate(key any) error

func (*KeyLRU) Find

func (lru *KeyLRU) Find(key any) (any, bool)

func (*KeyLRU) Keys

func (lru *KeyLRU) Keys() []any

func (*KeyLRU) Len

func (lru *KeyLRU) Len() int

Len returns the number of items in the cache.

func (*KeyLRU) Peek

func (lru *KeyLRU) Peek(key any) (any, bool)

func (*KeyLRU) Remove

func (lru *KeyLRU) Remove(key any) any

Remove removes Key from cl.

func (*KeyLRU) RemoveOldest

func (lru *KeyLRU) RemoveOldest() any

type LRU

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

LRU takes advantage of list's sequence and map's efficient locate

func (*LRU) Add

func (lru *LRU) Add(key any, value any) error

Add adds Key to the head of the linked list.

func (*LRU) AddOrUpdate

func (lru *LRU) AddOrUpdate(key any, value any) error

func (*LRU) AddPair

func (lru *LRU) AddPair(pair Pair) error

func (*LRU) Find

func (lru *LRU) Find(key any) (any, bool)

func (*LRU) Keys

func (lru *LRU) Keys() []any

func (*LRU) Len

func (lru *LRU) Len() int

Len returns the number of items in the cache.

func (*LRU) Pairs

func (lru *LRU) Pairs() []Pair

func (*LRU) Peek

func (lru *LRU) Peek(key any) (any, bool)

func (*LRU) Remove

func (lru *LRU) Remove(key any) any

Remove removes Key from cl.

func (*LRU) RemoveOldest

func (lru *LRU) RemoveOldest() any

func (*LRU) Values

func (lru *LRU) Values() []any

type Pair

type Pair struct {
	Key   any
	Value any
}

Jump to

Keyboard shortcuts

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