Go to the documentation of this file.
87 $this->cacheHelper->setCacheEnabled( $this->cacheEnabled );
88 $this->cacheHelper->setOnInitializedHandler( [ $this,
'onCacheInitialized' ] );
92 if ( array_key_exists(
'action', $keyArgs ) && $keyArgs[
'action'] ===
'purge' ) {
93 unset( $keyArgs[
'action'] );
96 $this->cacheHelper->setCacheKey( $keyArgs );
98 if ( $this->
getRequest()->getText(
'action' ) ===
'purge' ) {
99 $this->cacheHelper->rebuildOnDemand();
102 $this->cacheHelper->startCache( $cacheExpiry,
$cacheEnabled );
120 return $this->cacheHelper->getCachedValue( $computeFunction,
$args, $key );
136 $html = $this->cacheHelper->getCachedValue( $computeFunction,
$args, $key );
147 $this->cacheHelper->saveCache();
159 $this->cacheHelper->setExpiry( $cacheExpiry );
171 get_class( $this->page ),
186 $this->
getOutput()->setSubtitle( $this->cacheHelper->getCachedNotice( $this->getContext() ) );
onCacheInitialized( $hasCached)
Gets called after the cache got initialized.
saveCache()
Saves the HTML to the cache in case it got recomputed.
getCachedValue( $computeFunction, $args=[], $key=null)
Get a cached value if available or compute it if not and then cache it if possible.
getRequest()
Get the WebRequest being used for this instance.
getCacheKey()
Returns the variables used to constructed the cache key in an array.
setCacheEnabled( $cacheEnabled)
Sets if the cache should be enabled or not.
getName()
Return the name of the action this object responds to.
Interface for all classes implementing CacheHelper functionality.
Abstract action class with scaffolding for caching HTML and other values in a single blob.
bool $cacheEnabled
If the cache is enabled or not.
addCachedHTML( $computeFunction, $args=[], $key=null)
Add some HTML to be cached.
setExpiry( $cacheExpiry)
Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.
Helper class for caching various elements in a single cache entry.
CacheHelper $cacheHelper
CacheHelper object to which we forward the non-SpecialPage specific caching work.
getLanguage()
Shortcut to get the user Language being used for this instance.
startCache( $cacheExpiry=null, $cacheEnabled=null)
Initializes the caching.
getOutput()
Get the OutputPage being used for this instance.