Skip to content

Commit 880d1e6

Browse files
committed
check for non-zero
1 parent 4775523 commit 880d1e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

includes/object-cache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,7 @@ public function increment( $key, $offset = 1, $group = 'default' ) {
23562356
$value += $offset;
23572357
$serialized = $this->maybe_serialize( $value );
23582358

2359-
if ( $pttl = $this->redis->pttl( $derived_key ) ) {
2359+
if ( ($pttl = $this->redis->pttl( $derived_key )) > 0 ) {
23602360
$result = $this->parse_redis_response( $this->redis->set( $derived_key, $serialized, [ 'px' => $pttl ] ) );
23612361
} else {
23622362
$result = $this->parse_redis_response( $this->redis->set( $derived_key, $serialized ) );
@@ -2429,7 +2429,7 @@ public function decrement( $key, $offset = 1, $group = 'default' ) {
24292429
$value -= $offset;
24302430
$serialized = $this->maybe_serialize( $value );
24312431

2432-
if ( $pttl = $this->redis->pttl( $derived_key ) ) {
2432+
if ( ($pttl = $this->redis->pttl( $derived_key )) > 0 ) {
24332433
$result = $this->parse_redis_response( $this->redis->set( $derived_key, $serialized, [ 'px' => $pttl ] ) );
24342434
} else {
24352435
$result = $this->parse_redis_response( $this->redis->set( $derived_key, $serialized ) );

0 commit comments

Comments
 (0)