cache

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExpiredErr = errors.New("Data expired")
)

Functions

This section is empty.

Types

type BookCacher

type BookCacher interface {
	// init cache
	Init() error
	// get from cache by name
	// if data get but expired will return ExpireErr
	GetIfExists(name string, expireTime time.Time) ([]byte, error)
	// save data to cache
	Save(name string, data []byte) error
}

func NewDiskCache

func NewDiskCache(cacheDir string) BookCacher

type DiskCache

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

func (*DiskCache) GetIfExists

func (d *DiskCache) GetIfExists(name string, expireTime time.Time) ([]byte, error)

func (*DiskCache) Init

func (d *DiskCache) Init() error

func (*DiskCache) Save

func (d *DiskCache) Save(name string, data []byte) error

Jump to

Keyboard shortcuts

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