b6c4e27a by reterVision

Adjust the action order in Put function.

1 parent 2933d1fe
...@@ -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 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!