lru

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package lru is the concrete implementation of the cache abstraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache encapsulates a thread-safe fixed size LRU cache as defined in hashicorp/golang-lru.

func New

func New(size int) (*Cache, error)

New returns a new LRU cache that can hold 'size' number of keys at a time.

func (*Cache) Get

func (c *Cache) Get(key string) (interface{}, bool, error)

Get executes a lookup and returns whether a key exists in the cache along with its value.

func (*Cache) Purge

func (c *Cache) Purge() error

Purge evicts all keys present in the cache.

func (*Cache) Remove

func (c *Cache) Remove(key string) error

Remove evicts a specific key from the cache.

func (*Cache) Set

func (c *Cache) Set(key string, value interface{}) error

Set registers a key-value pair to the cache.

Jump to

Keyboard shortcuts

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