MediaWiki  1.30.0
WANCacheReapUpdate Class Reference

Class for fixing stale WANObjectCache keys using a purge event source. More...

Inheritance diagram for WANCacheReapUpdate:
Collaboration diagram for WANCacheReapUpdate:

Public Member Functions

 __construct (IDatabase $db, LoggerInterface $logger)
 
 doUpdate ()
 Perform the actual work. More...
 
 getEventAffectedKeys (WANObjectCache $cache, TitleValue $t)
 Gets a list of important cache keys associated with a title. More...
 
 getTitleChangeEvents ( $start, $id, $end, $limit)
 

Private Attributes

IDatabase $db
 
LoggerInterface $logger
 

Detailed Description

Class for fixing stale WANObjectCache keys using a purge event source.

This is useful for expiring keys that missed fire-and-forget purges. This uses the recentchanges table as a reliable stream to make certain keys reach consistency as soon as the underlying replica database catches up. These means that critical keys will not escape getting purged simply due to brief hiccups in the network, which are more prone to happen accross datacenters.


"I was trying to cheat death. I was only trying to surmount for a little while the darkness that all my life I surely knew was going to come rolling in on me some day and obliterate me. I was only to stay alive a little brief while longer, after I was already gone. To stay in the light, to be with the living, a little while past my time." -- Notes for "Blues of a Lifetime", by [[Cornell Woolrich]]

Since
1.28

Definition at line 24 of file WANCacheReapUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

WANCacheReapUpdate::__construct ( IDatabase  $db,
LoggerInterface  $logger 
)
Parameters
IDatabase$db
LoggerInterface$logger

Definition at line 34 of file WANCacheReapUpdate.php.

References $db, and $logger.

Member Function Documentation

◆ doUpdate()

WANCacheReapUpdate::doUpdate ( )

◆ getEventAffectedKeys()

WANCacheReapUpdate::getEventAffectedKeys ( WANObjectCache  $cache,
TitleValue  $t 
)

Gets a list of important cache keys associated with a title.

See also
WANObjectCacheRepear
Parameters
WANObjectCache$cache
TitleValue$t
Returns
string[]

Definition at line 103 of file WANCacheReapUpdate.php.

References $cache, $keys, $t, as, WikiPage\factory(), false, User\newFromName(), Title\newFromTitleValue(), NS_FILE, NS_USER, and wfLocalFile().

◆ getTitleChangeEvents()

WANCacheReapUpdate::getTitleChangeEvents (   $start,
  $id,
  $end,
  $limit 
)
See also
WANObjectCacheRepear
Parameters
int$start
int$id
int$end
int$limit
Returns
TitleValue[]

Definition at line 63 of file WANCacheReapUpdate.php.

References $db, $res, Wikimedia\Rdbms\IDatabase\addQuotes(), as, LIST_OR, Wikimedia\Rdbms\IDatabase\makeList(), Wikimedia\Rdbms\IDatabase\select(), Wikimedia\Rdbms\IDatabase\timestamp(), and wfTimestamp().

Member Data Documentation

◆ $db

IDatabase WANCacheReapUpdate::$db
private

Definition at line 26 of file WANCacheReapUpdate.php.

Referenced by __construct(), and getTitleChangeEvents().

◆ $logger

LoggerInterface WANCacheReapUpdate::$logger
private

Definition at line 28 of file WANCacheReapUpdate.php.

Referenced by __construct(), and doUpdate().


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