X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCacheHelper.php;h=695eac3a05abc6fd497816dde86fd7b1864c6de9;hb=9221f5ffd09b4f7347dbd5e251c96733c1becba1;hp=f6cd3a69146754a3200a0471c8956c9ab94a9cb1;hpb=8f12ae314af362c6f495188564618732f944538c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/CacheHelper.php b/includes/CacheHelper.php index f6cd3a6914..695eac3a05 100644 --- a/includes/CacheHelper.php +++ b/includes/CacheHelper.php @@ -28,12 +28,11 @@ * @since 1.20 */ interface ICacheHelper { - /** * Sets if the cache should be enabled or not. * * @since 1.20 - * @param boolean $cacheEnabled + * @param bool $cacheEnabled */ function setCacheEnabled( $cacheEnabled ); @@ -43,8 +42,8 @@ interface ICacheHelper { * * @since 1.20 * - * @param integer|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp. - * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. + * @param int|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp. + * @param bool|null $cacheEnabled Sets if the cache should be enabled or not. */ function startCache( $cacheExpiry = null, $cacheEnabled = null ); @@ -78,10 +77,9 @@ interface ICacheHelper { * * @since 1.20 * - * @param integer $cacheExpiry + * @param int $cacheExpiry */ function setExpiry( $cacheExpiry ); - } /** @@ -103,12 +101,11 @@ interface ICacheHelper { * @since 1.20 */ class CacheHelper implements ICacheHelper { - /** * The time to live for the cache, in seconds or a unix timestamp indicating the point of expiry. * * @since 1.20 - * @var integer + * @var int */ protected $cacheExpiry = 3600; @@ -127,7 +124,7 @@ class CacheHelper implements ICacheHelper { * Null if this information is not available yet. * * @since 1.20 - * @var boolean|null + * @var bool|null */ protected $hasCached = null; @@ -135,7 +132,7 @@ class CacheHelper implements ICacheHelper { * If the cache is enabled or not. * * @since 1.20 - * @var boolean + * @var bool */ protected $cacheEnabled = true; @@ -159,7 +156,7 @@ class CacheHelper implements ICacheHelper { * Sets if the cache should be enabled or not. * * @since 1.20 - * @param boolean $cacheEnabled + * @param bool $cacheEnabled */ public function setCacheEnabled( $cacheEnabled ) { $this->cacheEnabled = $cacheEnabled; @@ -171,8 +168,8 @@ class CacheHelper implements ICacheHelper { * * @since 1.20 * - * @param integer|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp. - * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. + * @param int|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp. + * @param bool|null $cacheEnabled Sets if the cache should be enabled or not. */ public function startCache( $cacheExpiry = null, $cacheEnabled = null ) { if ( is_null( $this->hasCached ) ) { @@ -195,7 +192,7 @@ class CacheHelper implements ICacheHelper { * @since 1.20 * * @param IContextSource $context - * @param boolean $includePurgeLink + * @param bool $includePurgeLink * * @return string */ @@ -275,7 +272,8 @@ class CacheHelper implements ICacheHelper { $itemKey = array_shift( $itemKey ); if ( !is_integer( $itemKey ) ) { - wfWarn( "Attempted to get item with non-numeric key while the next item in the queue has a key ($itemKey) in " . __METHOD__ ); + wfWarn( "Attempted to get item with non-numeric key while " . + "the next item in the queue has a key ($itemKey) in " . __METHOD__ ); } elseif ( is_null( $itemKey ) ) { wfWarn( "Attempted to get an item while the queue is empty in " . __METHOD__ ); } else { @@ -316,7 +314,11 @@ class CacheHelper implements ICacheHelper { */ public function saveCache() { if ( $this->cacheEnabled && $this->hasCached === false && !empty( $this->cachedChunks ) ) { - wfGetCache( CACHE_ANYTHING )->set( $this->getCacheKeyString(), $this->cachedChunks, $this->cacheExpiry ); + wfGetCache( CACHE_ANYTHING )->set( + $this->getCacheKeyString(), + $this->cachedChunks, + $this->cacheExpiry + ); } } @@ -326,7 +328,7 @@ class CacheHelper implements ICacheHelper { * * @since 1.20 * - * @param integer $cacheExpiry + * @param int $cacheExpiry */ public function setExpiry( $cacheExpiry ) { $this->cacheExpiry = $cacheExpiry; @@ -376,10 +378,9 @@ class CacheHelper implements ICacheHelper { * * @since 1.20 * - * @param $handlerFunction + * @param callable $handlerFunction */ public function setOnInitializedHandler( $handlerFunction ) { $this->onInitHandler = $handlerFunction; } - }