cache

package
v0.0.0-...-c5d59ff Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

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 stores arbitrary data for fast retrieval

func New

func New(budget int) *Cache

New creates an instance of a Cache

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all cache entries

func (*Cache) GetBudget

func (c *Cache) GetBudget() int

GetBudget gets the memory budget of a cache

func (*Cache) GetWeight

func (c *Cache) GetWeight() int

GetWeight gets the "weight" of a cache

func (*Cache) Insert

func (c *Cache) Insert(key string, value interface{}, weight int) error

Insert inserts an object into the cache

func (*Cache) Retrieve

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

Retrieve gets an object out of the cache

func (*Cache) SetVerbose

func (c *Cache) SetVerbose(verbose bool)

SetVerbose turns on verbose printing (warnings and stuff)

Jump to

Keyboard shortcuts

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