atomiccache

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package atomiccache provides a map-based cache that supports very fast reads.

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 is a map-based cache that supports fast reads via use of atomics. Writes are slow, requiring a copy of the entire cache. The zero Cache is an empty cache, ready for use.

func (*Cache) Get

func (c *Cache) Get(key interface{}, getter func() interface{}) interface{}

Get returns the value of the cache at key. If there is no value, getter is called to provide one, and the cache is updated. The getter function may be called concurrently. It should be pure, returning the same value for every call.

Jump to

Keyboard shortcuts

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