Skip to content

Commit

Permalink
Merge pull request #46 from andrewhoff/master
Browse files Browse the repository at this point in the history
Use time.Millisecond in comparison
  • Loading branch information
novln authored Nov 7, 2018
2 parents 3cab803 + 26b9dc7 commit 38b2a44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/store/redis/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ func updateValue(rtx *libredis.Tx, key string, expiration time.Duration) (int64,
return 0, 0, err
}

// If ttl is -1, we have to define key expiration.
// If ttl is -1ms, we have to define key expiration.
// PTTL return values changed as of Redis 2.8
// Now the command returns -2 if the key does not exist, and -1 if the key exists, but there is no expiry set
// Now the command returns -2ms if the key does not exist, and -1ms if the key exists, but there is no expiry set
// We shouldn't try to set an expiry on a key that doesn't exist
if ttl == -1 {
if ttl == (-1 * time.Millisecond) {
expire := rtx.Expire(key, expiration)

ok, err := expire.Result()
Expand Down

0 comments on commit 38b2a44

Please sign in to comment.