Documentation ¶
Overview ¶
Package redis for cache provider
depend on github.com/gomodule/redigo/redis
go install github.com/gomodule/redigo/redis
Usage: import(
_ "github.com/kfchen81/beego/cache/redis" "github.com/kfchen81/beego/cache"
)
bm, err := cache.NewCache("redis", `{"conn":"127.0.0.1:11211"}`) more docs http://beego.me/docs/module/cache.md
Index ¶
- Variables
- func NewRedisCache() cache.Cache
- type Cache
- func (rc *Cache) ClearAll() error
- func (rc *Cache) Decr(key string) error
- func (rc *Cache) Delete(key string) error
- func (rc *Cache) Get(key string) interface{}
- func (rc *Cache) GetMulti(keys []string) []interface{}
- func (rc *Cache) Incr(key string) error
- func (rc *Cache) IsExist(key string) bool
- func (rc *Cache) Put(key string, val interface{}, timeout time.Duration) error
- func (rc *Cache) StartAndGC(config string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// DefaultKey the collection name of redis for cache adapter.
DefaultKey = "beecacheRedis"
)
Functions ¶
func NewRedisCache ¶
NewRedisCache create new redis cache with default collection name.
Types ¶
type Cache ¶ added in v1.6.0
type Cache struct {
// contains filtered or unexported fields
}
Cache is Redis cache adapter.
func (*Cache) ClearAll ¶ added in v1.6.0
ClearAll clean all cache in redis. delete this redis collection.
func (*Cache) StartAndGC ¶ added in v1.6.0
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.
Click to show internal directories.
Click to hide internal directories.