cache

package
v0.0.0-...-a2814e5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 7 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 interface {
	// Get retrieves the value from cache. Returns the value if found and true,
	// or a nil array and false if not cached.
	Get(key string, value interface{}) (ok bool)

	// Put attempts to save the value in cache.
	Put(key string, value interface{})
}

Cache is an interface for caching values.

func NewCache

func NewCache(filename string, expiration time.Duration) Cache

NewCache always returns a valid cache implementation. First, it tries to return a file cache using bolt database. If there is an error loading the file or creating it, it returns a no-op cache implementation.

type Item

type Item struct {
	Value     []byte
	Timestamp time.Time
}

Item represents a cached item value

Jump to

Keyboard shortcuts

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