MediaWiki  master
MediaWiki\Storage\EditResultCache Class Reference

Class allowing easy storage and retrieval of EditResults associated with revisions. More...

Collaboration diagram for MediaWiki\Storage\EditResultCache:

Public Member Functions

 __construct (BagOStuff $mainObjectStash, ILoadBalancer $loadBalancer, ServiceOptions $options)
 
 get (int $revisionId)
 Get an EditResult for the given revision ID. More...
 
 set (int $revisionId, EditResult $editResult)
 Store the EditResult in the main object stash. More...
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Member Functions

 makeKey (int $revisionId)
 Generates a cache key for the given revision ID. More...
 

Private Attributes

ILoadBalancer $loadBalancer
 
BagOStuff $mainObjectStash
 
ServiceOptions $options
 
const CACHE_KEY_PREFIX = 'EditResult'
 

Detailed Description

Class allowing easy storage and retrieval of EditResults associated with revisions.

EditResults are stored in the main object stash and (depending on wiki's configuration) in revert change tags. This class stores the relevant data in the main stash. When asked to retrieve an EditResult for an edit and the requested key is not present in the main stash, the class will attempt to retrieve the EditResult from revert tags.

Since
1.36
Access: internal
Used by RevertedTagUpdateManager

Definition at line 42 of file EditResultCache.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Storage\EditResultCache::__construct ( BagOStuff  $mainObjectStash,
ILoadBalancer  $loadBalancer,
ServiceOptions  $options 
)

Member Function Documentation

◆ get()

MediaWiki\Storage\EditResultCache::get ( int  $revisionId)

Get an EditResult for the given revision ID.

Will first attempt to get the EditResult from the main stash. If this fails, it will try to retrieve the EditResult from revert change tags of this revision.

Parameters
int$revisionId
Returns
EditResult|null Returns null on failure

Definition at line 104 of file EditResultCache.php.

References $dbr, DB_REPLICA, FormatJson\decode(), MediaWiki\Storage\EditResultCache\makeKey(), and MediaWiki\Storage\EditResult\newFromArray().

◆ makeKey()

MediaWiki\Storage\EditResultCache::makeKey ( int  $revisionId)
private

Generates a cache key for the given revision ID.

Parameters
int$revisionId
Returns
string

Definition at line 141 of file EditResultCache.php.

Referenced by MediaWiki\Storage\EditResultCache\get(), and MediaWiki\Storage\EditResultCache\set().

◆ set()

MediaWiki\Storage\EditResultCache::set ( int  $revisionId,
EditResult  $editResult 
)

Store the EditResult in the main object stash.

Parameters
int$revisionId
EditResult$editResult
Returns
bool Success

Definition at line 85 of file EditResultCache.php.

References FormatJson\encode(), and MediaWiki\Storage\EditResultCache\makeKey().

Member Data Documentation

◆ $loadBalancer

ILoadBalancer MediaWiki\Storage\EditResultCache::$loadBalancer
private

Definition at line 54 of file EditResultCache.php.

Referenced by MediaWiki\Storage\EditResultCache\__construct().

◆ $mainObjectStash

BagOStuff MediaWiki\Storage\EditResultCache::$mainObjectStash
private

Definition at line 51 of file EditResultCache.php.

Referenced by MediaWiki\Storage\EditResultCache\__construct().

◆ $options

ServiceOptions MediaWiki\Storage\EditResultCache::$options
private

Definition at line 57 of file EditResultCache.php.

Referenced by MediaWiki\Storage\EditResultCache\__construct().

◆ CACHE_KEY_PREFIX

const MediaWiki\Storage\EditResultCache::CACHE_KEY_PREFIX = 'EditResult'
private

Definition at line 48 of file EditResultCache.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Storage\EditResultCache::CONSTRUCTOR_OPTIONS
Initial value:
= [
'RCMaxAge'
]

Definition at line 44 of file EditResultCache.php.


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