Adjust the action order in Put function.
Showing
1 changed file
with
2 additions
and
2 deletions
| ... | @@ -57,11 +57,11 @@ func (rc *RedisCache) Get(key string) interface{} { | ... | @@ -57,11 +57,11 @@ func (rc *RedisCache) Get(key string) interface{} { |
| 57 | 57 | ||
| 58 | // put cache to redis. | 58 | // put cache to redis. |
| 59 | func (rc *RedisCache) Put(key string, val interface{}, timeout int64) error { | 59 | func (rc *RedisCache) Put(key string, val interface{}, timeout int64) error { |
| 60 | _, err := rc.do("HSET", rc.key, key, true) | 60 | _, err := rc.do("SET", key, val) |
| 61 | if err != nil { | 61 | if err != nil { |
| 62 | return nil | 62 | return nil |
| 63 | } | 63 | } |
| 64 | _, err = rc.do("SET", key, val) | 64 | _, err = rc.do("HSET", rc.key, key, true) |
| 65 | if err != nil { | 65 | if err != nil { |
| 66 | return nil | 66 | return nil |
| 67 | } | 67 | } | ... | ... |
-
Please register or sign in to post a comment