cache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MIT Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Del

func Del(key string) error

func Get

func Get(key string, v interface{}) error

func Has

func Has(key string) bool

func IsNotFound

func IsNotFound(err error) bool

func RegisterCache

func RegisterCache(name string, cache Cache) error

func Set

func Set(key string, v interface{}, ttl time.Duration) error

func SetDefault

func SetDefault(driver string) error

func Take

func Take(v interface{}, key string, ttl time.Duration, query func() (interface{}, error)) error

Types

type Cache

type Cache interface {
	Get(key string, v interface{}) error
	Set(key string, v interface{}, ttl time.Duration) error
	Has(key string) bool
	Del(key string) error
	Take(v interface{}, key string, ttl time.Duration, query func() (interface{}, error)) error
	IsNotFound(err error) bool
}

func GetCache

func GetCache(driver string) Cache

GetCache return a Cache driver,if has multi Cache Driver

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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