lru

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2020 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LRU

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

func New

func New(capacity int) *LRU

func (*LRU) Get

func (lru *LRU) Get(k interface{}) (v interface{}, exist bool)

func (*LRU) Put

func (lru *LRU) Put(k interface{}, v interface{}) bool

注意: 1. 无论插入前,元素是否已经存在,插入后,元素都会存在于lru容器中 2. 插入元素时,也会更新热度(不管插入前元素是否已经存在) @return 插入前元素已经存在则返回false

func (*LRU) Size

func (lru *LRU) Size() int

Jump to

Keyboard shortcuts

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