Merge "objectcache: make MediumSpecificBagOStuff::mergeViaCas() handle negative TTLs"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 25 Aug 2019 16:57:41 +0000 (16:57 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 25 Aug 2019 16:57:41 +0000 (16:57 +0000)
1  2 
includes/libs/objectcache/MediumSpecificBagOStuff.php

@@@ -293,11 -323,9 +293,11 @@@ abstract class MediumSpecificBagOStuff 
                        unset( $currentValue ); // free RAM in case the value is large
  
                        $this->clearLastError();
-                       if ( $value === false ) {
+                       if ( $value === false || $exptime < 0 ) {
                                $success = true; // do nothing
 -                      } elseif ( $hadNoCurrentValue ) {
 +                      } elseif ( $valueMatchesOldValue && $attemptsLeft !== $attempts ) {
 +                              $success = true; // recently set by another thread to the same value
 +                      } elseif ( $keyWasNonexistant ) {
                                // Try to create the key, failing if it gets created in the meantime
                                $success = $this->add( $key, $value, $exptime, $flags );
                        } else {