lru

package
v1.2.59 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 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
}

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

func (*KeyLRU) Add

func (lru *KeyLRU) Add(key interface{}) error

add adds Key to the head of the linked list.

func (*KeyLRU) AddOrUpdate

func (lru *KeyLRU) AddOrUpdate(key interface{}) error

func (*KeyLRU) Find

func (lru *KeyLRU) Find(key interface{}) (interface{}, bool)

func (*KeyLRU) Keys

func (lru *KeyLRU) Keys() []interface{}

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 interface{}) (interface{}, bool)

func (*KeyLRU) Remove

func (lru *KeyLRU) Remove(key interface{}) interface{}

Remove removes Key from cl.

func (*KeyLRU) RemoveOldest

func (lru *KeyLRU) RemoveOldest() interface{}

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 interface{}, value interface{}) error

Add adds Key to the head of the linked list.

func (*LRU) AddOrUpdate

func (lru *LRU) AddOrUpdate(key interface{}, value interface{}) error

func (*LRU) AddPair

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

func (*LRU) Find

func (lru *LRU) Find(key interface{}) (interface{}, bool)

func (*LRU) Keys

func (lru *LRU) Keys() []interface{}

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 interface{}) (interface{}, bool)

func (*LRU) Remove

func (lru *LRU) Remove(key interface{}) interface{}

Remove removes Key from cl.

func (*LRU) RemoveOldest

func (lru *LRU) RemoveOldest() interface{}

func (*LRU) Values

func (lru *LRU) Values() []interface{}

type Pair

type Pair struct {
	Key   interface{}
	Value interface{}
}

Jump to

Keyboard shortcuts

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