Documentation ¶
Index ¶
- Variables
- type Cache
- func (rc *Cache) Brpop(key string, callback func([]byte))
- func (rc *Cache) DelMuti(keys ...string) error
- func (rc *Cache) Delete(key string) error
- func (rc *Cache) Do(commandName string, args ...interface{}) (reply interface{}, err error)
- func (rc *Cache) Get(key string) interface{}
- func (rc *Cache) GetRedisTTL(key string) time.Duration
- func (rc *Cache) Incrby(key string, num int) (interface{}, error)
- func (rc *Cache) IsExist(key string) bool
- func (rc *Cache) LPush(key string, val interface{}) error
- func (rc *Cache) LRem(key string, count int, val interface{}) error
- func (rc *Cache) Lock(key string, timeout time.Duration) bool
- func (rc *Cache) Put(key string, val interface{}, timeout time.Duration) error
- func (rc *Cache) RedisBytes(key string) (data []byte, err error)
- func (rc *Cache) RedisInt(key string) (data int, err error)
- func (rc *Cache) RedisString(key string) (data string, err error)
- func (rc *Cache) SetNX(key string, val interface{}, timeout time.Duration) bool
- 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 = "commonRedis"
)
View Source
var RetryMaxTimeInterval int64 = 30
Lock请求锁的最大时间间隔(毫秒)
View Source
var RetryMinTimeInterval int64 = 5
当一次Lock失败之后,会随机在RetryMinTimeInterval和RetryMaxTimeInterval之间 取一个随机值作为下次请求锁的时间间隔 Lock请求锁的最小时间间隔(毫秒)
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is Redis cache adapter.
func (*Cache) StartAndGC ¶
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.