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

Source Files