cache

package
v0.0.0-...-0c4a1b3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

LRU cache wiki: https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU) impl1: https://dev.to/clavinjune/lru-cache-in-go-1cfk impl2: https://github.com/baidu/go-lib/blob/master/lru_cache/lru_cache.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSyncStore

func NewSyncStore() *store

Types

type LRU

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

func NewLRU

func NewLRU(capacity int) *LRU

func (*LRU) Get

func (l *LRU) Get(key int) int

func (*LRU) Set

func (l *LRU) Set(key, value int)

func (*LRU) ShowQueue

func (l *LRU) ShowQueue()

type Node

type Node struct {
	Key   int
	Value int
	Prev  *Node
	Next  *Node
}

func NewNode

func NewNode(key, value int) *Node

Jump to

Keyboard shortcuts

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