mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 21:01:31 +00:00
improve the Put #896
This commit is contained in:
parent
71149218d1
commit
db43892fe6
3
cache/redis/redis.go
vendored
3
cache/redis/redis.go
vendored
@ -75,14 +75,13 @@ func (rc *RedisCache) Get(key string) interface{} {
|
||||
// put cache to redis.
|
||||
func (rc *RedisCache) Put(key string, val interface{}, timeout int64) error {
|
||||
var err error
|
||||
if _, err = rc.do("SET", key, val); err != nil {
|
||||
if _, err = rc.do("SETEX", key, timeout, val); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err = rc.do("HSET", rc.key, key, true); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = rc.do("EXPIRE", key, timeout)
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user