X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FMemoizedCallable.php;h=12a5cadb993f22354dd6e458654d699c52aaff96;hb=768b2de54f5c51c7b518891421db6708721fa525;hp=14de6b903455719ff62cb8d3bf5d4bc345799b60;hpb=cac3014651345b4fab5638c38bde8bd822734066;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/MemoizedCallable.php b/includes/libs/MemoizedCallable.php index 14de6b9034..12a5cadb99 100644 --- a/includes/libs/MemoizedCallable.php +++ b/includes/libs/MemoizedCallable.php @@ -1,6 +1,6 @@ ttl ); + } elseif ( function_exists( 'apcu_store' ) ) { + apcu_store( $key, $result, $this->ttl ); } } @@ -102,7 +106,7 @@ class MemoizedCallable { * @param array $args Parameters for memoized function or method. * @return mixed The memoized callable's return value. */ - public function invokeArgs( Array $args = array() ) { + public function invokeArgs( array $args = [] ) { foreach ( $args as $arg ) { if ( $arg !== null && !is_scalar( $arg ) ) { throw new InvalidArgumentException( @@ -144,7 +148,7 @@ class MemoizedCallable { * @param array $args * @param int $ttl */ - public static function call( $callable, Array $args = array(), $ttl = 3600 ) { + public static function call( $callable, array $args = [], $ttl = 3600 ) { $instance = new self( $callable, $ttl ); return $instance->invokeArgs( $args ); }