timercache

package
v0.0.0-...-13c8884 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

定时更新cache: 每类cache有一个更新时间, 到期后, 整体更新该类数据

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCache

func GetCache(key string) interface{}

func Register

func Register(key string, c Cacher)

func Start

func Start()

Types

type AtomicCache

type AtomicCache struct {
	Cache map[string]*CacheData
	*sync.RWMutex
}

func NewAtomicCache

func NewAtomicCache() *AtomicCache

func (*AtomicCache) GetCache

func (this *AtomicCache) GetCache(key string) interface{}

func (*AtomicCache) Register

func (this *AtomicCache) Register(key string, c Cacher)

func (*AtomicCache) Start

func (this *AtomicCache) Start()

type CacheData

type CacheData struct {
	Cacher
	//	Key string
	Data interface{}
}

//////////////////////////////////////////////////////////////////////////////

type Cacher

type Cacher interface {
	LoadData() (interface{}, error)
	GetRefreshTime() time.Duration
	LogName() string
}

//////////////////////////////////////////////////////////////////////////////

Jump to

Keyboard shortcuts

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