X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fobjectcache%2FBagOStuff.php;h=217142c0b4e43c71c73da239ce2d96001944cc8a;hb=feeac7bdfc9c629e40e5de0b1825daa2bd634a55;hp=58ddd6a001e33964853e0290254e936e36abb3fd;hpb=892ee7a4af4714c09e4ec7a74408f53f8256ae35;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 58ddd6a001..217142c0b4 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -3,7 +3,7 @@ * Classes to cache objects in PHP accelerators, SQL database or DBA files * * Copyright © 2003-2004 Brion Vibber - * http://www.mediawiki.org/ + * https://www.mediawiki.org/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -142,7 +142,7 @@ abstract class BagOStuff { * @return bool success */ protected function mergeViaLock( $key, closure $callback, $exptime = 0, $attempts = 10 ) { - if ( !$this->lock( $key, 60 ) ) { + if ( !$this->lock( $key, 6 ) ) { return false; } @@ -168,9 +168,9 @@ abstract class BagOStuff { * @param $timeout integer [optional] * @return bool success */ - public function lock( $key, $timeout = 60 ) { + public function lock( $key, $timeout = 6 ) { $timestamp = microtime( true ); // starting UNIX timestamp - if ( $this->add( "{$key}:lock", $timeout ) ) { + if ( $this->add( "{$key}:lock", 1, $timeout ) ) { return true; } @@ -186,7 +186,7 @@ abstract class BagOStuff { $sleep *= 2; } usleep( $sleep ); // back off - $locked = $this->add( "{$key}:lock", $timeout ); + $locked = $this->add( "{$key}:lock", 1, $timeout ); } while ( !$locked ); return $locked; @@ -250,8 +250,10 @@ abstract class BagOStuff { * @param $value mixed * @param $exptime int * @return bool success + * @deprecated 1.23 */ public function replace( $key, $value, $exptime = 0 ) { + wfDeprecated( __METHOD__, '1.23' ); if ( $this->get( $key ) !== false ) { return $this->set( $key, $value, $exptime ); }