MediaWiki  master
HtmlCacheUpdater Class Reference

Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles. More...

Collaboration diagram for HtmlCacheUpdater:

Public Member Functions

 __construct (HookContainer $hookContainer, $reboundDelay, $useFileCache, $cdnMaxAge)
 
 getUrls (Title $title, int $flags=0)
 Get a list of URLs to purge from the CDN cache when this page changes. More...
 
 purgeTitleUrls ( $titles, $flags=self::PURGE_PRESEND, array $unless=[])
 Purge the CDN/HTMLFileCache for a title or the titles yielded by an iterator. More...
 
 purgeUrls ( $urls, $flags=self::PURGE_PRESEND, array $unless=[])
 Purge the CDN for a URL or list of URLs. More...
 

Private Member Functions

 fieldHasFlag ( $flags, $flag)
 

Private Attributes

int $cdnMaxAge
 Max seconds for CDN to served cached objects without revalidation. More...
 
HookRunner $hookRunner
 
int $reboundDelay
 Seconds between initial and rebound purges; 0 if disabled. More...
 
int $useFileCache
 Whether filesystem-based HTML output caching is enabled. More...
 

Detailed Description

Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.

Since
1.35

Definition at line 30 of file HtmlCacheUpdater.php.

Constructor & Destructor Documentation

◆ __construct()

HtmlCacheUpdater::__construct ( HookContainer  $hookContainer,
  $reboundDelay,
  $useFileCache,
  $cdnMaxAge 
)
Parameters
HookContainer$hookContainer
int$reboundDelay$wgCdnReboundPurgeDelay
bool$useFileCache$wgUseFileCache
int$cdnMaxAge$wgCdnMaxAge

Definition at line 90 of file HtmlCacheUpdater.php.

References $cdnMaxAge, $reboundDelay, and $useFileCache.

Member Function Documentation

◆ fieldHasFlag()

HtmlCacheUpdater::fieldHasFlag (   $flags,
  $flag 
)
private
Parameters
int$flagsBit field
int$flagConstant to check for
Returns
bool If $flags contains $flag

Definition at line 104 of file HtmlCacheUpdater.php.

Referenced by getUrls(), purgeTitleUrls(), and purgeUrls().

◆ getUrls()

HtmlCacheUpdater::getUrls ( Title  $title,
int  $flags = 0 
)

Get a list of URLs to purge from the CDN cache when this page changes.

Parameters
Title$title
int$flagsBit field of PURGE_URLS_* class constants (optional).
Returns
string[] URLs

Definition at line 177 of file HtmlCacheUpdater.php.

References $title, $urls, and fieldHasFlag().

Referenced by purgeTitleUrls().

◆ purgeTitleUrls()

HtmlCacheUpdater::purgeTitleUrls (   $titles,
  $flags = self::PURGE_PRESEND,
array  $unless = [] 
)

Purge the CDN/HTMLFileCache for a title or the titles yielded by an iterator.

All cacheable canonical URLs associated with the titles will be purged from CDN. All cacheable actions associated with the titles will be purged from HTMLFileCache.

Parameters
Traversable | Title[] | Title$titlesTitle or iterator yielding Title instances
int$flagsBit field of class PURGE_* constants [Default: HtmlCacheUpdater::PURGE_PRESEND]
mixed[]$unlessOptional map of (HtmlCacheUpdater::UNLESS_* constant => value)

Definition at line 147 of file HtmlCacheUpdater.php.

References $title, $urls, DeferredUpdates\addUpdate(), fieldHasFlag(), getUrls(), HtmlFileCacheUpdate\newFromTitles(), DeferredUpdates\PRESEND, and purgeUrls().

◆ purgeUrls()

HtmlCacheUpdater::purgeUrls (   $urls,
  $flags = self::PURGE_PRESEND,
array  $unless = [] 
)

Purge the CDN for a URL or list of URLs.

Parameters
string[] | string$urlsURL or list of URLs
int$flagsBit field of class PURGE_* constants [Default: HtmlCacheUpdater::PURGE_PRESEND]
mixed[]$unlessOptional map of (HtmlCacheUpdater::UNLESS_* constant => value)

Definition at line 116 of file HtmlCacheUpdater.php.

References $reboundDelay, $urls, DeferredUpdates\addUpdate(), fieldHasFlag(), and DeferredUpdates\PRESEND.

Referenced by purgeTitleUrls().

Member Data Documentation

◆ $cdnMaxAge

int HtmlCacheUpdater::$cdnMaxAge
private

Max seconds for CDN to served cached objects without revalidation.

Definition at line 36 of file HtmlCacheUpdater.php.

Referenced by __construct().

◆ $hookRunner

HookRunner HtmlCacheUpdater::$hookRunner
private

Definition at line 39 of file HtmlCacheUpdater.php.

◆ $reboundDelay

int HtmlCacheUpdater::$reboundDelay
private

Seconds between initial and rebound purges; 0 if disabled.

Definition at line 32 of file HtmlCacheUpdater.php.

Referenced by __construct(), and purgeUrls().

◆ $useFileCache

int HtmlCacheUpdater::$useFileCache
private

Whether filesystem-based HTML output caching is enabled.

Definition at line 34 of file HtmlCacheUpdater.php.

Referenced by __construct().


The documentation for this class was generated from the following file: