beego: github.com/astaxie/beego/cache/redis Index | Files

package redis

import "github.com/astaxie/beego/cache/redis"

Package redis for cache provider

depend on github.com/gomodule/redigo/redis

go install github.com/gomodule/redigo/redis

Usage: import(

_ "github.com/astaxie/beego/cache/redis"
"github.com/astaxie/beego/cache"

)

bm, err := cache.NewCache("redis", `{"conn":"127.0.0.1:11211"}`)

more docs http://beego.me/docs/module/cache.md

Index

Package Files

redis.go

Variables

var (
    // DefaultKey the collection name of redis for cache adapter.
    DefaultKey = "beecacheRedis"
)

func NewRedisCache Uses

func NewRedisCache() cache.Cache

NewRedisCache create new redis cache with default collection name.

type Cache Uses

type Cache struct {
    // contains filtered or unexported fields
}

Cache is Redis cache adapter.

func (*Cache) ClearAll Uses

func (rc *Cache) ClearAll() error

ClearAll clean all cache in redis. delete this redis collection.

func (*Cache) Decr Uses

func (rc *Cache) Decr(key string) error

Decr decrease counter in redis.

func (*Cache) Delete Uses

func (rc *Cache) Delete(key string) error

Delete delete cache in redis.

func (*Cache) Get Uses

func (rc *Cache) Get(key string) interface{}

Get cache from redis.

func (*Cache) GetMulti Uses

func (rc *Cache) GetMulti(keys []string) []interface{}

GetMulti get cache from redis.

func (*Cache) Incr Uses

func (rc *Cache) Incr(key string) error

Incr increase counter in redis.

func (*Cache) IsExist Uses

func (rc *Cache) IsExist(key string) bool

IsExist check cache's existence in redis.

func (*Cache) Put Uses

func (rc *Cache) Put(key string, val interface{}, timeout time.Duration) error

Put put cache to redis.

func (*Cache) StartAndGC Uses

func (rc *Cache) StartAndGC(config string) error

StartAndGC start redis cache adapter. config is like {"key":"collection key","conn":"connection info","dbNum":"0"} the cache item in redis are stored forever, so no gc operation.

Package redis imports 8 packages (graph) and is imported by 20 packages. Updated 2018-09-30. Refresh now. Tools for package owners.