Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor Class Reference

A WikiPageEntityMetaDataAccessor decorator that implements prefetching and caching. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor:

Public Member Functions

 __construct (WikiPageEntityMetaDataAccessor $lookup, LoggerInterface $logger, $maxCacheKeys=1000)
 
 prefetch (array $entityIds)
 Marks the given entity ids for prefetching.
 
 purge (EntityId $entityId)
 
 purgeAll ()
 Purges all prefetched data.
 
 entityDeleted (EntityId $entityId)
 
 entityUpdated (EntityRevision $entityRevision)
 
 redirectUpdated (EntityRedirect $entityRedirect, $revisionId)
 
 loadRevisionInformation (array $entityIds, $mode)
 
 loadRevisionInformationByRevisionId (EntityId $entityId, $revisionId, $mode=LookupConstants::LATEST_FROM_MASTER)
 
 loadLatestRevisionIds (array $entityIds, $mode)
 

Private Member Functions

 increaseCacheSize ( $newSize)
 
 doFetch ( $mode)
 
 store (array $data)
 

Private Attributes

 $lookup
 
 $cache
 
 $logger
 
 $toFetch = []
 

Detailed Description

A WikiPageEntityMetaDataAccessor decorator that implements prefetching and caching.

Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::__construct ( WikiPageEntityMetaDataAccessor $lookup,
LoggerInterface $logger,
$maxCacheKeys = 1000 )
Parameters
WikiPageEntityMetaDataAccessor$lookup
LoggerInterface$logger
int$maxCacheKeysMaximum number of entries to cache (defaults to 1000)

Member Function Documentation

◆ doFetch()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::doFetch ( $mode)
private

◆ entityDeleted()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::entityDeleted ( EntityId $entityId)
See also
EntityStoreWatcher::entityDeleted

SingleEntitySourceServices assumes that this only needs to be called if the service has been created as a MapCacheLRU is used internally.

Parameters
EntityId$entityId

Implements Wikibase\Lib\Store\EntityStoreWatcher.

◆ entityUpdated()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::entityUpdated ( EntityRevision $entityRevision)
See also
EntityStoreWatcher::entityDeleted

SingleEntitySourceServices assumes that this only needs to be called if the service has been created as a MapCacheLRU is used internally.

Parameters
EntityRevision$entityRevision

Implements Wikibase\Lib\Store\EntityStoreWatcher.

◆ increaseCacheSize()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::increaseCacheSize ( $newSize)
private
Parameters
int$newSize

◆ loadLatestRevisionIds()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::loadLatestRevisionIds ( array $entityIds,
$mode )
See also
WikiPageEntityMetaDataAccessor::loadLatestRevisionIds
Parameters
EntityId[]$entityIds
string$mode( LookupConstants::LATEST_FROM_REPLICA, LookupConstants::LATEST_FROM_REPLICA_WITH_FALLBACK or LookupConstants::LATEST_FROM_MASTER)
Returns
(int|bool)[] Array of entity ID serialization => revision IDs or false if an entity could not be found (including if the page is a redirect).

Implements Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor.

◆ loadRevisionInformation()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::loadRevisionInformation ( array $entityIds,
$mode )
See also
WikiPageEntityMetaDataAccessor::loadRevisionInformation
Parameters
EntityId[]$entityIds
string$mode( LookupConstants::LATEST_FROM_REPLICA, LookupConstants::LATEST_FROM_REPLICA_WITH_FALLBACK or LookupConstants::LATEST_FROM_MASTER)
Returns
(stdClass|bool)[] Array mapping entity ID serializations to either objects or false if an entity could not be found.

Implements Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor.

◆ loadRevisionInformationByRevisionId()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::loadRevisionInformationByRevisionId ( EntityId $entityId,
$revisionId,
$mode = LookupConstants::LATEST_FROM_MASTER )
See also
WikiPageEntityMetaDataAccessor::loadRevisionInformationByRevisionId
Parameters
EntityId$entityId
int$revisionId
string$mode( LookupConstants::LATEST_FROM_REPLICA, LookupConstants::LATEST_FROM_REPLICA_WITH_FALLBACK or LookupConstants::LATEST_FROM_MASTER)
Returns
stdClass|bool false if no such entity exists

Implements Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor.

◆ prefetch()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::prefetch ( array $entityIds)

Marks the given entity ids for prefetching.

XXX: This does not obey the definition of the EntityPrefetcher interface, that says this should actually fetch.

Parameters
EntityId[]$entityIds

Implements Wikibase\DataModel\Services\Entity\EntityPrefetcher.

◆ purge()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::purge ( EntityId $entityId)
See also
EntityPrefetcher::purge
Parameters
EntityId$entityId

Implements Wikibase\DataModel\Services\Entity\EntityPrefetcher.

◆ purgeAll()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::purgeAll ( )

Purges all prefetched data.

Implements Wikibase\DataModel\Services\Entity\EntityPrefetcher.

◆ redirectUpdated()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::redirectUpdated ( EntityRedirect $entityRedirect,
$revisionId )
See also
EntityStoreWatcher::redirectUpdated

SingleEntitySourceServices assumes that this only needs to be called if the service has been created as a MapCacheLRU is used internally.

Parameters
EntityRedirect$entityRedirect
int$revisionId

Implements Wikibase\Lib\Store\EntityStoreWatcher.

◆ store()

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::store ( array $data)
private

Member Data Documentation

◆ $cache

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::$cache
private

◆ $logger

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::$logger
private

◆ $lookup

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::$lookup
private

◆ $toFetch

Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor::$toFetch = []
private

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