cache

package
v0.0.0-...-126e10b Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 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 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) Delete

func (c *Cache) Delete(key string) bool

Delete removes an object from the cache by key

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

Jump to

Keyboard shortcuts

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