cache

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Drivers

func Drivers() (list []string)

func Register

func Register(name string, driver CacheDriver)

Types

type Cache

type Cache interface {
	Has(key string) (bool, error)
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	SetTTL(key string, value []byte, ttl time.Duration) error
	Delete(key string) error
	Flush() error
	Notify(name string, args ...string) 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