lru_cache

package
v0.0.0-...-42829d4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LRUCache

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

func NewLRUCache

func NewLRUCache(capacity int) *LRUCache

NewLRUCache returns a new, empty LRUCache

func (*LRUCache) Add

func (c *LRUCache) Add(key interface{}, value interface{}) bool

Add adds a key-value pair to LRU cache, true if eviction occurs, false if not

func (*LRUCache) Del

func (c *LRUCache) Del(key interface{})

Del deletes cached value from cache

func (*LRUCache) EnlargeCapacity

func (c *LRUCache) EnlargeCapacity(newCapacity int) error

EnlargeCapacity enlarges the capacity of cache

func (*LRUCache) Get

func (c *LRUCache) Get(key interface{}) (interface{}, bool)

Get get cached value from LRU cache The second return value indicates whether key is found or not, true if found, false if not

func (*LRUCache) Keys

func (c *LRUCache) Keys() []interface{}

Keys returns keys of items in cache

func (*LRUCache) Len

func (c *LRUCache) Len() int

Len returns number of items in cache

type Pair

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

Jump to

Keyboard shortcuts

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