cache

package
v0.0.0-...-ff80121 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserInfo  = "user:%d"
	OrderInfo = "order:%d"
)
View Source
const FiveMinutes = 300

5 分钟

View Source
const Forever = 0

Forever

View Source
const HalfDay = 43200

12 小时(半天)

View Source
const HalfHour = 1800

半小时

View Source
const OneDay = 86400

24 小时(1 天)

View Source
const OneHour = 3600

One hour

View Source
const OneMinutes = 60

One minutes

View Source
const OneWeek = 604800

7 天(一周)

View Source
const TenMinutes = 600

10 分钟

View Source
const ThreeDay = 259200

3 天

View Source
const ThreeHour = 10800

3 小时

View Source
const ThreeMinutes = 180

ThreeMinutes 3 分钟

View Source
const TwoDay = 172800

2 天

View Source
const TwoHour = 7200

2 小时

View Source
const TwoMinutes = 120

Two minutes 2 分钟

Variables

This section is empty.

Functions

func ClosePool

func ClosePool() error

ClosePool Close pool

func Connection

func Connection() redis.Conn

Connection return redis connection. Usage:

conn := redis.Connection()
defer conn.Close()
... do something ...

func Delete

func Delete(key string) error

Delete cache

func GenKey

func GenKey(tpl string, keys ...interface{}) string

GenKey gen cache key

func Get

func Get(key string) interface{}

Get cache from redis.

func GetAndMapTo

func GetAndMapTo(key string, v interface{}) (err error)

Get cache and map to a struct Usage:

cache.GetAndMapTo("key", &User{})

func Has

func Has(key string) bool

Has cache key

func InitCache

func InitCache() (err error)

init cache redis conn pool ref package: github.com/astaxie/beego/cache/redis redigo doc https://godoc.org/github.com/gomodule/redigo/redis#pkg-examples

func Set

func Set(key string, data interface{}, ttl int) error

Set cache

Types

This section is empty.

Jump to

Keyboard shortcuts

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