@@ 306-314 (lines=9) @@ | ||
303 | $value = call_user_func( $callback, $this, $key, $currentValue, $exptime ); |
|
304 | ||
305 | $this->clearLastError(); |
|
306 | if ( $value === false ) { |
|
307 | $success = true; // do nothing |
|
308 | } elseif ( $currentValue === false ) { |
|
309 | // Try to create the key, failing if it gets created in the meantime |
|
310 | $success = $this->add( $key, $value, $exptime ); |
|
311 | } else { |
|
312 | // Try to update the key, failing if it gets changed in the meantime |
|
313 | $success = $this->cas( $casToken, $key, $value, $exptime ); |
|
314 | } |
|
315 | if ( $this->getLastError() ) { |
|
316 | return false; // IO error; don't spam retries |
|
317 | } |
|
@@ 360-368 (lines=9) @@ | ||
357 | ||
358 | if ( $this->getLastError() ) { |
|
359 | $success = false; |
|
360 | } else { |
|
361 | // Derive the new value from the old value |
|
362 | $value = call_user_func( $callback, $this, $key, $currentValue, $exptime ); |
|
363 | if ( $value === false ) { |
|
364 | $success = true; // do nothing |
|
365 | } else { |
|
366 | $success = $this->set( $key, $value, $exptime, $flags ); // set the new value |
|
367 | } |
|
368 | } |
|
369 | ||
370 | if ( !$this->unlock( $key ) ) { |
|
371 | // this should never happen |