Skip to content

Commit

Permalink
redis.SetNX up
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdaoqiang committed May 12, 2022
1 parent daef69b commit f51c585
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/gcache/redis/gcache_redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ func (r *Redis) SetNX(k string, v string, exp time.Duration) (bool, error) {
r.Connect(k)
// set kv
result, err := r.RedisConn.SetNX(k, v, exp).Result()
if err == redis.Nil {
return false, nil
} else if err != nil {
if err != nil {
return false, err
}
return result, nil
Expand Down

0 comments on commit f51c585

Please sign in to comment.