cache

package
v0.0.0-...-e25bc3e Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 3 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.Mutex

	Name string
	// contains filtered or unexported fields
}

func New

func New(name string, MaxEntries int) *Cache

New creates a new LRU cache of the request length with an exported Name for instrumentation

func (*Cache) Get

func (c *Cache) Get(key string, getFn func() (interface{}, error)) (i interface{}, err error, hit bool)

Get returns a cached value based on the passed key or runs the passed function to get the value if there is no corresponding value in the cache

Jump to

Keyboard shortcuts

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