Back to godoc.org
bosun.org / cmd / bosun / cache

Package cache

v0.0.0-...-8a7cd2d
Latest Go to latest

The latest major version is .

Published: Jun 18, 2020 | License: MIT | Module: bosun.org

Index

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier