lazycache

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lazy

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

func New

func New(maxAge time.Duration, loadFn LazyFunc) *Lazy

创建LazyCache

func (*Lazy) ForceLoad

func (c *Lazy) ForceLoad() (interface{}, error)

强制重新加载数据

func (*Lazy) Get

func (c *Lazy) Get() interface{}

获取数据,如果没有缓存则返回nil

func (*Lazy) StartAutoRefresh

func (c *Lazy) StartAutoRefresh(interval time.Duration)

自动刷新

func (*Lazy) StopAutoRefresh

func (c *Lazy) StopAutoRefresh()

停止自动刷新

type LazyFunc

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

Jump to

Keyboard shortcuts

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