X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Flockmanager%2FMemcLockManager.php;h=7f5f003df9285194009dce77267c01e513341a23;hb=fcbb9f71e9095a754fad3d1469314b1d317d3430;hp=ebd72de894ea1589d1dee3074020f1655e5562b8;hpb=59cc46fa644563786e86440fefbbbd599f39d951;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/lockmanager/MemcLockManager.php b/includes/libs/lockmanager/MemcLockManager.php index ebd72de894..7f5f003df9 100644 --- a/includes/libs/lockmanager/MemcLockManager.php +++ b/includes/libs/lockmanager/MemcLockManager.php @@ -46,7 +46,7 @@ class MemcLockManager extends QuorumLockManager { /** @var MemcachedBagOStuff[] Map of (server name => MemcachedBagOStuff) */ protected $cacheServers = []; - /** @var HashBagOStuff Server status cache */ + /** @var MapCacheLRU Server status cache */ protected $statusCache; /** @@ -81,7 +81,7 @@ class MemcLockManager extends QuorumLockManager { $this->cacheServers[$name] = new $class( $params ); } - $this->statusCache = new HashBagOStuff(); + $this->statusCache = new MapCacheLRU( 100 ); } protected function getLocksOnServer( $lockSrv, array $pathsByType ) { @@ -89,7 +89,7 @@ class MemcLockManager extends QuorumLockManager { $memc = $this->getCache( $lockSrv ); // List of affected paths - $paths = call_user_func_array( 'array_merge', array_values( $pathsByType ) ); + $paths = array_merge( ...array_values( $pathsByType ) ); $paths = array_unique( $paths ); // List of affected lock record keys $keys = array_map( [ $this, 'recordKeyForPath' ], $paths ); @@ -164,7 +164,7 @@ class MemcLockManager extends QuorumLockManager { $memc = $this->getCache( $lockSrv ); // List of affected paths - $paths = call_user_func_array( 'array_merge', array_values( $pathsByType ) ); + $paths = array_merge( ...array_values( $pathsByType ) ); $paths = array_unique( $paths ); // List of affected lock record keys $keys = array_map( [ $this, 'recordKeyForPath' ], $paths ); @@ -252,13 +252,13 @@ class MemcLockManager extends QuorumLockManager { throw new InvalidArgumentException( "Invalid cache server '$lockSrv'." ); } - $online = $this->statusCache->get( "online:$lockSrv" ); - if ( $online === false ) { + $online = $this->statusCache->get( "online:$lockSrv", 30 ); + if ( $online === null ) { $online = $this->cacheServers[$lockSrv]->set( __CLASS__ . ':ping', 1, 1 ); if ( !$online ) { // server down? $this->logger->warning( __METHOD__ . ": Could not contact $lockSrv." ); } - $this->statusCache->set( "online:$lockSrv", (int)$online, 30 ); + $this->statusCache->set( "online:$lockSrv", (int)$online ); } return $online ? $this->cacheServers[$lockSrv] : null;