lrucache

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package lrucache implements LRU (Least Recently Used) node

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LRUCache

type LRUCache struct {
	sync.RWMutex
	cache.UnImplementedCache
	// contains filtered or unexported fields
}

LRUCache data structure

func NewCache

func NewCache(capacity bytesize.ByteSize) *LRUCache

NewCache LRUCache constructor

func (*LRUCache) Delete

func (c *LRUCache) Delete(key string) (ok bool)

applyDelete the key from the node

func (*LRUCache) Get

func (c *LRUCache) Get(key string) (value string, ok bool)

Get returns the value for the key

func (*LRUCache) Put

func (c *LRUCache) Put(key string, value string) (created bool)

applyPut updates or insert a new entry, evicts the old entry if node size is larger than capacity

func (*LRUCache) Restore added in v0.1.7

func (c *LRUCache) Restore(closer io.ReadCloser) error

func (*LRUCache) Snapshot added in v0.1.7

func (c *LRUCache) Snapshot() (raft.FSMSnapshot, error)

Jump to

Keyboard shortcuts

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