cachelayer

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 8 Imported by: 0

README

cachelayer

a cache layer for golang

store with serialization

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildKey

func BuildKey(args ...interface{}) string

Types

type CacheLayer

type CacheLayer struct {
	// contains filtered or unexported fields
}

func New

func New(freshTime, lifeTime time.Duration) *CacheLayer

func (*CacheLayer) Clear

func (l *CacheLayer) Clear()

func (*CacheLayer) ClearIfNilErr

func (l *CacheLayer) ClearIfNilErr(err error) error

func (*CacheLayer) Get

func (l *CacheLayer) Get(key string, output interface{}, fetchFn FetchFunc) error

func (*CacheLayer) SetDebugLogger

func (l *CacheLayer) SetDebugLogger(logger DebugLogger)

func (*CacheLayer) SetStoreOriginData

func (l *CacheLayer) SetStoreOriginData()

SetStoreOriginData in store origin mode, you should not change cache item's value at any time

type DebugLogger

type DebugLogger interface {
	Log(keyname string, hit bool, msg string)
}

type FetchFunc

type FetchFunc func() (interface{}, error)

Jump to

Keyboard shortcuts

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