cache

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
	ErrExpired  = errors.New("expired")
)

Functions

func Drivers

func Drivers() (list []string)

func Register

func Register(name string, driver CacheDriver)

Types

type Cache

type Cache interface {
	Has(ctx context.Context, key string) (bool, error)
	Get(ctx context.Context, key string) ([]byte, error)
	Put(ctx context.Context, key string, data []byte) error
	PutTemp(ctx context.Context, key string, data []byte, lifetime time.Duration) error
	Delete(ctx context.Context, key string) error
	Flush(ctx context.Context) error
	Run(ctx context.Context, name string, args ...[]byte) error
}

func New

func New(url string) (cache Cache, err error)

New returns a new cache by url

type CacheDriver

type CacheDriver interface {
	Open(addr string, args map[string]string) (cache Cache, err error)
}

Jump to

Keyboard shortcuts

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