cache

package
v0.0.0-...-beb8713 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetValue

func SetValue(value interface{}, result interface{})

SetValue will write result to value

Types

type Cache

type Cache interface {
	GetAndLoad(key string, value interface{}, loader func() (interface{}, error)) error
	Get(key string, value interface{}) error
	Set(key string, value interface{}, expiration *time.Duration) error
	Delete(key string) error
}

Cache can GetAndLoad, Get, Set, and Delete items by key

func New

func New(backend Storage, expiration time.Duration, ignoreSetErrors bool, log Logger) Cache

New returns a new *Cache

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

Logger can log using Printf

type Storage

type Storage interface {
	Get(key string, value interface{}) error
	Set(key string, value interface{}, expiration time.Duration) error
	Delete(key string) error
}

Storage provides Get, Set, and Delete to a cache backend

Directories

Path Synopsis
Package mock_cache is a generated GoMock package.
Package mock_cache is a generated GoMock package.

Jump to

Keyboard shortcuts

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