Merge "objectcache: Use faster getArrayCopy() in WAN cache methods"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 10 Jun 2017 15:38:29 +0000 (15:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 10 Jun 2017 15:38:30 +0000 (15:38 +0000)
1  2 
includes/libs/objectcache/WANObjectCache.php

@@@ -202,7 -202,8 +202,7 @@@ class WANObjectCache implements IExpiri
        public static function newEmpty() {
                return new self( [
                        'cache'   => new EmptyBagOStuff(),
 -                      'pool'    => 'empty',
 -                      'relayer' => new EventRelayerNull( [] )
 +                      'pool'    => 'empty'
                ] );
        }
  
        final public function getMultiWithSetCallback(
                ArrayIterator $keyedIds, $ttl, callable $callback, array $opts = []
        ) {
-               $valueKeys = array_keys( iterator_to_array( $keyedIds, true ) );
+               $valueKeys = array_keys( $keyedIds->getArrayCopy() );
                $checkKeys = isset( $opts['checkKeys'] ) ? $opts['checkKeys'] : [];
  
                // Load required keys into process cache in one go
        final public function getMultiWithUnionSetCallback(
                ArrayIterator $keyedIds, $ttl, callable $callback, array $opts = []
        ) {
-               $idsByValueKey = iterator_to_array( $keyedIds, true );
+               $idsByValueKey = $keyedIds->getArrayCopy();
                $valueKeys = array_keys( $idsByValueKey );
                $checkKeys = isset( $opts['checkKeys'] ) ? $opts['checkKeys'] : [];
                unset( $opts['lockTSE'] ); // incompatible