|
@@ -170,12 +170,12 @@ func (rc *StandaloneRedisClient) Put(key string, val interface{}, timeout time.D
|
|
|
// @param timeout
|
|
|
// @return bool
|
|
|
func (rc *StandaloneRedisClient) SetNX(key string, val interface{}, timeout time.Duration) bool {
|
|
|
- result, err := rc.redisClient.SetEX(context.TODO(), key, val, timeout).Result()
|
|
|
- if err != nil || result != "OK" {
|
|
|
+ result, err := rc.redisClient.SetNX(context.TODO(), key, val, timeout).Result()
|
|
|
+ if err != nil {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
- return true
|
|
|
+ return result
|
|
|
}
|
|
|
|
|
|
// Delete
|