cache

package
v0.0.0-...-2ee2aa9 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package cache contains structs and methods to cache data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LRU

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

LRU represents a LRU cache

func NewLRU

func NewLRU(maxEntries int) (*LRU, error)

NewLRU creates a new LRU Cache.

func (*LRU) Add

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

Add adds a value to the cache.

func (*LRU) Clear

func (c *LRU) Clear()

Clear purges all stored items from the cache.

func (*LRU) Get

func (c *LRU) Get(key interface{}) (value interface{}, ok bool)

Get looks up a key's value from the cache.

func (*LRU) Len

func (c *LRU) Len() int

Len returns the number of items in the cache.

Jump to

Keyboard shortcuts

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