Documentation ¶
Overview ¶
package redis for cache provider
depend on github.com/garyburd/redigo/redis
go install github.com/garyburd/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 ¶
- Variables
- type RedisCache
- func (rc *RedisCache) ClearAll() error
- func (rc *RedisCache) Decr(key string) error
- func (rc *RedisCache) Delete(key string) error
- func (rc *RedisCache) Get(key string) interface{}
- func (rc *RedisCache) GetMulti(keys []string) []interface{}
- func (rc *RedisCache) Incr(key string) error
- func (rc *RedisCache) IsExist(key string) bool
- func (rc *RedisCache) Put(key string, val interface{}, timeout int64) error
- func (rc *RedisCache) StartAndGC(config string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // the collection name of redis for cache adapter. DefaultKey string = "beecacheRedis" )
Functions ¶
This section is empty.
Types ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
Redis cache adapter.
func NewRedisCache ¶
func NewRedisCache() *RedisCache
create new redis cache with default collection name.
func (*RedisCache) ClearAll ¶
func (rc *RedisCache) ClearAll() error
clean all cache in redis. delete this redis collection.
func (*RedisCache) GetMulti ¶ added in v1.5.0
func (rc *RedisCache) GetMulti(keys []string) []interface{}
GetMulti get cache from redis.
func (*RedisCache) IsExist ¶
func (rc *RedisCache) IsExist(key string) bool
check cache's existence in redis.
func (*RedisCache) Put ¶
func (rc *RedisCache) Put(key string, val interface{}, timeout int64) error
put cache to redis.
func (*RedisCache) StartAndGC ¶
func (rc *RedisCache) StartAndGC(config string) error
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.
Click to show internal directories.
Click to hide internal directories.