cache

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MSG_CACHE_NOT_FOUND = "Cache not found"

Variables

This section is empty.

Functions

func Bool added in v0.0.3

func Bool(key string, def bool) bool

* * Bool return a bool from cache * @param key string * @param def bool * @return bool *

func Clear

func Clear(match string)

* * Clear all keys in cache *

func Del

func Del(key string) bool

* * Del a value in cache * @param key string * @return bool *

func Get

func Get(key string, def string) (string, error)

* * SetY a value in cache for one year * @param key string * @param value interface{} * @return interface{} *

func Int added in v0.0.3

func Int(key string, def int64) int64

* * Int return a int from cache * @param key string * @param def int * @return int *

func Item added in v0.0.3

func Item(key string) (js.Item, error)

* * Item return a item object from cache * @param key string * @return js.Item * @return error *

func Items added in v0.0.3

func Items(key string) (js.Items, error)

* * Items return a items object from cache * @param key string * @return js.Items * @return error *

func Json added in v0.0.3

func Json(key string) (js.Json, error)

* * Json return a json object from cache * @param key string * @return js.Json * @return error *

func Keys

func Keys() []string

* * Keys return all keys in cache * @return []string *

func Len

func Len() int

* * Len return the number of keys in cache * @return int *

func Load

func Load() error

* * Load cache * @return error *

func More added in v0.0.3

func More(key string, expiration time.Duration) int64

* * Count the number of keys in cache * @param key string * @param expiration time.Duration * @return int *

func Num added in v0.0.3

func Num(key string, def float64) float64

* * Num return a float64 from cache * @param key string * @param def float64 * @return float64 *

func Set

func Set(key string, value interface{}, expiration time.Duration) interface{}

* * Set a value in cache * @param key string * @param value string * @param expiration time.Duration * @return string *

func SetD added in v0.0.3

func SetD(key string, value interface{}) interface{}

* * SetD a value in cache for one day * @param key string * @param value interface{} * @return interface{} *

func SetH added in v0.0.3

func SetH(key string, value interface{}) interface{}

* * SetH a value in cache for one hour * @param key string * @param value interface{} * @return interface{} *

func SetM added in v0.0.3

func SetM(key string, value interface{}) interface{}

* * SetM a value in cache for one month * @param key string * @param value interface{} * @return interface{} *

func SetW added in v0.0.3

func SetW(key string, value interface{}) interface{}

* * SetW a value in cache for one week * @param key string * @param value interface{} * @return interface{} *

func Time added in v0.0.3

func Time(key string, def time.Time) time.Time

* * Time return a time.Time from cache * @param key string * @param def time.Time * @return time.Time *

func Type

func Type() string

* * Type return the type of cache * @return string *

func Values

func Values() []string

* * Values return all values in cache * @return []string *

Types

type Cache

type Cache interface {
	Type() string
	Set(key string, value string, expiration time.Duration) string
	Get(key string, def string) (string, error)
	Del(key string) bool
	More(key string, expiration time.Duration) int64
	Clear(match string)
	Empty()
	Len() int
	Keys() []string
	Values() []string
}

type TpCahe

type TpCahe int

Type adatapter

const (
	TpRedis TpCahe = iota
	TpMem
)

func (TpCahe) String

func (tp TpCahe) String() string

Jump to

Keyboard shortcuts

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