1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-10 03:00:19 +00:00
This commit is contained in:
youngsterxyf
2016-01-08 13:47:14 +08:00
parent db2918b0aa
commit bb43d3a78c
9 changed files with 42 additions and 40 deletions

7
cache/cache.go vendored
View File

@ -23,7 +23,7 @@
//
// Use it like this:
//
// bm.Put("astaxie", 1, 10)
// bm.Put("astaxie", 1, time.Second * 10)
// bm.Get("astaxie")
// bm.IsExist("astaxie")
// bm.Delete("astaxie")
@ -33,13 +33,14 @@ package cache
import (
"fmt"
"time"
)
// Cache interface contains all behaviors for cache adapter.
// usage:
// cache.Register("file",cache.NewFileCache) // this operation is run in init method of file.go.
// c,err := cache.NewCache("file","{....}")
// c.Put("key",value,3600)
// c.Put("key",value, time.Second * 3600)
// v := c.Get("key")
//
// c.Incr("counter") // now is 1
@ -51,7 +52,7 @@ type Cache interface {
// GetMulti is a batch version of Get.
GetMulti(keys []string) []interface{}
// set cached value with key and expire time.
Put(key string, val interface{}, timeout int64) error
Put(key string, val interface{}, timeout time.Duration) error
// delete cached value by key.
Delete(key string) error
// increase cached int value by key, as a counter.