Wikibase
MediaWiki Wikibase extension
|
Short-term sitelink conflict lookup using a BagOStuff (e.g. More...
Public Member Functions | |
__construct (BagOStuff $bagOStuff) | |
getConflictsForItem (ItemId $itemId, SiteLinkList $siteLinkList, int $db=null) | |
Returns an array with the conflicts between the item and the sitelinks currently in the store. | |
clearConflictsForItem (Item $item) | |
Remove the item’s sitelinks from the BagOStuff. | |
Private Member Functions | |
getConflictForSiteLink (string $itemId, SiteLink $siteLink) | |
Try to write a sitelink to BagOStuff, returning a conflict array on failure. | |
peekConflictForSiteLink (string $itemId, SiteLink $siteLink) | |
Check if a sitelink is present in the BagOStuff without writing to it. | |
clearConflictsForSiteLinks (array $siteLinks) | |
cacheKey (SiteLink $siteLink) | |
Private Attributes | |
$bagOStuff | |
Short-term sitelink conflict lookup using a BagOStuff (e.g.
memcached).
When getConflictsForItem
is called in write mode (with DB_PRIMARY), then the lookup will attempt to write each sitelink to the BagOStuff; any sitelink already present there will be reported as a conflict. The written sitelinks can later be removed by calling clearConflictsForItem
.
Compared to SqlSiteLinkConflictLookup
, this class detects conflicts earlier, but less reliably: its purpose is to prevent race conditions on simultaneous saves, before sitelinks have been written to the database (in a secondary data update).
Wikibase\Repo\Store\BagOStuffSiteLinkConflictLookup::__construct | ( | BagOStuff | $bagOStuff | ) |
|
private |
Wikibase\Repo\Store\BagOStuffSiteLinkConflictLookup::clearConflictsForItem | ( | Item | $item | ) |
Remove the item’s sitelinks from the BagOStuff.
This should be called after the sitelinks were written to wb_items_per_site (and after that write was committed).
|
private |
|
private |
Try to write a sitelink to BagOStuff, returning a conflict array on failure.
Wikibase\Repo\Store\BagOStuffSiteLinkConflictLookup::getConflictsForItem | ( | ItemId | $item, |
SiteLinkList | $siteLinkList, | ||
int | $db = null ) |
Returns an array with the conflicts between the item and the sitelinks currently in the store.
The array is empty if there are no such conflicts.
The items in the return array are arrays with the following elements:
ItemId | $item | |
SiteLinkList | $siteLinkList | |
int | null | $db | The database flag to use (optional). Use one of DB_PRIMARY or DB_REPLICA. DB_PRIMARY can be used when you need the most recent data. |
Implements Wikibase\Repo\Store\SiteLinkConflictLookup.
|
private |
Check if a sitelink is present in the BagOStuff without writing to it.
|
private |