Skip to content

Commit

Permalink
change Get(ptrValue interface)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Aug 20, 2021
1 parent 5d62ae4 commit 6145583
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (gr *GRedis) Add(key string, value interface{}, ttl time.Duration) (err err
// has a chance to override this logic. Some drivers better support the way
// this operation should work with a total "atomic" implementation of it.
var obj interface{}
obj, err = gr.Get(key, &obj)
obj, err = gr.Get(key, obj)
if err == ErrCacheMiss {
return gr.SetEx(key, value, ttl)
} else {
Expand Down Expand Up @@ -186,7 +186,7 @@ func (gr *GRedis) Get(key string, ptrValue interface{}) (returnValue interface{}
if err != nil {
return nil, err
}
err = json.Unmarshal(b, ptrValue)
err = json.Unmarshal(b, &ptrValue)
returnValue = ptrValue
return returnValue, err
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func (gr *GRedis) Flush() error {
func (gr *GRedis) Remember(key string, ttl time.Duration, callback func() interface{}) (obj interface{}, err error) {

var value interface{}
value, err = gr.Get(key, &value)
value, err = gr.Get(key, value)

// If the item exists in the cache we will just return this immediately and if
// not we will execute the given Closure and cache the result of that for a
Expand Down

0 comments on commit 6145583

Please sign in to comment.