MediaWiki
REL1_24
|
Public Member Functions | |
addCachedHTML ($computeFunction, $args=array(), $key=null) | |
Add some HTML to be cached. | |
getCachedValue ($computeFunction, $args=array(), $key=null) | |
Get a cached value if available or compute it if not and then cache it if possible. | |
onCacheInitialized ($hasCached) | |
Gets called after the cache got initialized. | |
saveCache () | |
Saves the HTML to the cache in case it got recomputed. | |
setCacheEnabled ($cacheEnabled) | |
Sets if the cache should be enabled or not. | |
setExpiry ($cacheExpiry) | |
Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry. | |
startCache ($cacheExpiry=null, $cacheEnabled=null) | |
Initializes the caching. | |
Protected Member Functions | |
afterExecute ($subPage) | |
Gets called after. | |
getCacheKey () | |
Returns the variables used to constructed the cache key in an array. | |
Protected Attributes | |
bool | $cacheEnabled = true |
If the cache is enabled or not. | |
CacheHelper | $cacheHelper |
CacheHelper object to which we forward the non-SpecialPage specific caching work. |
Definition at line 40 of file SpecialCachedPage.php.
SpecialCachedPage::addCachedHTML | ( | $ | computeFunction, |
$ | args = array() , |
||
$ | key = null |
||
) |
Add some HTML to be cached.
This is done by providing a callback function that should return the HTML to be added. It will only be called if the item is not in the cache yet or when the cache has been invalidated.
callable | $computeFunction | |
array | $args | |
string | null | $key |
Definition at line 141 of file SpecialCachedPage.php.
SpecialCachedPage::afterExecute | ( | $ | subPage | ) | [protected] |
Gets called after.
string | null | $subPage |
Reimplemented from SpecialPage.
Definition at line 63 of file SpecialCachedPage.php.
SpecialCachedPage::getCachedValue | ( | $ | computeFunction, |
$ | args = array() , |
||
$ | key = null |
||
) |
Get a cached value if available or compute it if not and then cache it if possible.
The provided $computeFunction is only called when the computation needs to happen and should return a result value. $args are arguments that will be passed to the compute function when called.
callable | $computeFunction | |
array | mixed | $args | |
string | null | $key |
Implements ICacheHelper.
Definition at line 125 of file SpecialCachedPage.php.
SpecialCachedPage::getCacheKey | ( | ) | [protected] |
Returns the variables used to constructed the cache key in an array.
Definition at line 180 of file SpecialCachedPage.php.
SpecialCachedPage::onCacheInitialized | ( | $ | hasCached | ) |
Gets called after the cache got initialized.
bool | $hasCached |
Definition at line 194 of file SpecialCachedPage.php.
Saves the HTML to the cache in case it got recomputed.
Should be called after the last time anything is added via addCachedHTML.
Implements ICacheHelper.
Definition at line 155 of file SpecialCachedPage.php.
SpecialCachedPage::setCacheEnabled | ( | $ | cacheEnabled | ) |
Sets if the cache should be enabled or not.
bool | $cacheEnabled |
Implements ICacheHelper.
Definition at line 75 of file SpecialCachedPage.php.
SpecialCachedPage::setExpiry | ( | $ | cacheExpiry | ) |
Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.
int | $cacheExpiry |
Implements ICacheHelper.
Definition at line 169 of file SpecialCachedPage.php.
SpecialCachedPage::startCache | ( | $ | cacheExpiry = null , |
$ | cacheEnabled = null |
||
) |
Initializes the caching.
Should be called before the first time anything is added via addCachedHTML.
int | null | $cacheExpiry | Sets the cache expiry, either ttl in seconds or unix timestamp. |
bool | null | $cacheEnabled | Sets if the cache should be enabled or not. |
Implements ICacheHelper.
Definition at line 88 of file SpecialCachedPage.php.
bool SpecialCachedPage::$cacheEnabled = true [protected] |
CacheHelper SpecialCachedPage::$cacheHelper [protected] |
CacheHelper object to which we forward the non-SpecialPage specific caching work.
Initialized in startCache.
Definition at line 47 of file SpecialCachedPage.php.