safecache

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeCache

type SafeCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SafeCache 防穿透防雪崩的缓存

func NewSafeCache

func NewSafeCache(cache *gocache.Cache, pool *ants.Pool) *SafeCache

NewSafeCache ..

func (*SafeCache) GetOrBuild

func (sc *SafeCache) GetOrBuild(key string, build func() (interface{}, error)) (interface{}, error)

GetOrBuild 获取或重建缓存

Jump to

Keyboard shortcuts

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