lru

package
v0.0.0-...-9276249 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache LRU map+双向链表

func NewCache

func NewCache(maxBytes int64, onRemoved func(key string, value Value)) *Cache

func (*Cache) Add

func (this *Cache) Add(key string, value Value)

func (*Cache) Get

func (this *Cache) Get(key string) (value Value, ok bool)

func (*Cache) Len

func (this *Cache) Len() int

func (*Cache) RemoveOldest

func (this *Cache) RemoveOldest()

type Element

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

Element 节点

type Value

type Value interface {
	Len() int
}

Value 返回节点占用内存大小

Jump to

Keyboard shortcuts

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