|
MediaWiki
master
|
Interface for all classes implementing CacheHelper functionality. More...

Public Member Functions | |
| getCachedValue ($computeFunction, $args=[], $key=null) | |
| Get a cached value if available or compute it if not and then cache it if possible. More... | |
| saveCache () | |
| Saves the HTML to the cache in case it got recomputed. More... | |
| setCacheEnabled ($cacheEnabled) | |
| Sets if the cache should be enabled or not. More... | |
| setExpiry ($cacheExpiry) | |
| Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry... More... | |
| startCache ($cacheExpiry=null, $cacheEnabled=null) | |
| Initializes the caching. More... | |
Interface for all classes implementing CacheHelper functionality.
Definition at line 30 of file CacheHelper.php.
| ICacheHelper::getCachedValue | ( | $computeFunction, | |
$args = [], |
|||
$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 |
Implemented in CacheHelper, SpecialCachedPage, and CachedAction.
| ICacheHelper::saveCache | ( | ) |
Saves the HTML to the cache in case it got recomputed.
Should be called after the last time anything is added via addCachedHTML.
Implemented in CacheHelper, SpecialCachedPage, and CachedAction.
| ICacheHelper::setCacheEnabled | ( | $cacheEnabled | ) |
Sets if the cache should be enabled or not.
| bool | $cacheEnabled |
Implemented in CacheHelper, SpecialCachedPage, and CachedAction.
| ICacheHelper::setExpiry | ( | $cacheExpiry | ) |
Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry...
| int | $cacheExpiry |
Implemented in CacheHelper, SpecialCachedPage, and CachedAction.
| ICacheHelper::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. |
Implemented in CacheHelper, SpecialCachedPage, and CachedAction.