if ( $this->_debug ) {
$this->_debugprint( sprintf( "%s %s (%s)", $cmd, $key, $line ) );
}
- if ( $line == "STORED" ) {
+ if ( $line === "STORED" ) {
+ return true;
+ } elseif ( $line === "NOT_STORED" && $cmd === "set" ) {
+ // "Not stored" is always used as the mcrouter response with AllAsyncRoute
return true;
}
+
return false;
}
public function set( $key, $value, $exptime = 0, $flags = 0 ) {
$this->debugLog( "set($key)" );
- return $this->checkResult( $key, parent::set( $key, $value, $exptime ) );
+ $result = parent::set( $key, $value, $exptime );
+ if ( $result === false && $this->client->getResultCode() === Memcached::RES_NOTSTORED ) {
+ // "Not stored" is always used as the mcrouter response with AllAsyncRoute
+ return true;
+ }
+ return $this->checkResult( $key, $result );
}
protected function cas( $casToken, $key, $value, $exptime = 0 ) {
if ( $result === false && $this->client->getResultCode() === Memcached::RES_NOTFOUND ) {
// "Not found" is counted as success in our interface
return true;
- } else {
- return $this->checkResult( $key, $result );
}
+ return $this->checkResult( $key, $result );
}
public function add( $key, $value, $exptime = 0 ) {