95 $this->cacheHelper->setCacheEnabled( $this->cacheEnabled );
96 $this->cacheHelper->setOnInitializedHandler( [ $this,
'onCacheInitialized' ] );
100 if ( array_key_exists(
'action', $keyArgs ) && $keyArgs[
'action'] ===
'purge' ) {
101 unset( $keyArgs[
'action'] );
104 $this->cacheHelper->setCacheKey( $keyArgs );
106 if ( $this->
getRequest()->getText(
'action' ) ===
'purge' ) {
107 $this->cacheHelper->rebuildOnDemand();
110 $this->cacheHelper->startCache( $cacheExpiry,
$cacheEnabled );
128 return $this->cacheHelper->getCachedValue( $computeFunction,
$args, $key );
144 $html = $this->cacheHelper->getCachedValue( $computeFunction,
$args, $key );
155 $this->cacheHelper->saveCache();
167 $this->cacheHelper->setExpiry( $cacheExpiry );
194 $this->
getOutput()->setSubtitle( $this->cacheHelper->getCachedNotice( $this->getContext() ) );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
getName()
Return the name of the action this object responds to.
WikiPage Article ImagePage CategoryPage Page $page
Page on which we're performing the action.
getOutput()
Get the OutputPage being used for this instance.
IContextSource $context
IContextSource if specified; otherwise we'll use the Context from the Page.
getArticle()
Get a Article object.
getLanguage()
Shortcut to get the user Language being used for this instance.
getRequest()
Get the WebRequest being used for this instance.
Helper class for caching various elements in a single cache entry.
Abstract action class with scaffolding for caching HTML and other values in a single blob.
CacheHelper $cacheHelper
CacheHelper object to which we forward the non-SpecialPage specific caching work.
addCachedHTML( $computeFunction, $args=[], $key=null)
Add some HTML to be cached.
setCacheEnabled( $cacheEnabled)
Sets if the cache should be enabled or not.
saveCache()
Saves the HTML to the cache in case it got recomputed.
startCache( $cacheExpiry=null, $cacheEnabled=null)
Initializes the caching.
bool $cacheEnabled
If the cache is enabled or not.
onCacheInitialized( $hasCached)
Gets called after the cache got initialized.
getCachedValue( $computeFunction, $args=[], $key=null)
Get a cached value if available or compute it if not and then cache it if possible.
setExpiry( $cacheExpiry)
Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.
__construct(Page $page, IContextSource $context=null)
Only public since 1.21.
getCacheKey()
Returns the variables used to constructed the cache key in an array.
Interface for all classes implementing CacheHelper functionality.
Interface for objects which can provide a MediaWiki context on request.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)