cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 2 Imported by: 0

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
}

LruCache defines the structure of least recently used cache.

func NewLRUCache

func NewLRUCache(capacity int) *LruCache

NewLRUCache creates a new LRU cache.

func (*LruCache) Get

func (lru *LruCache) Get(key []byte) ([]byte, bool)

Get gets the value by a key.

func (*LruCache) Set

func (lru *LruCache) Set(key, value []byte)

Set add a key-value pair to cache, the value will updated it the key already exists.

Jump to

Keyboard shortcuts

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