Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\CachingEntityRevisionLookup Class Reference

Implementation of EntityLookup that caches the obtained entities. More...

+ Inheritance diagram for Wikibase\Lib\Store\CachingEntityRevisionLookup:
+ Collaboration diagram for Wikibase\Lib\Store\CachingEntityRevisionLookup:

Public Member Functions

 __construct (EntityRevisionCache $entityRevisionCache, EntityRevisionLookup $entityRevisionLookup)
 
 setVerifyRevision ( $shouldVerifyRevision)
 Determine whether the revision of the cached entity should be verified against the current revision in the underlying lookup. More...
 
 getEntityRevision (EntityId $entityId, $revisionId=0, $mode=LookupConstants::LATEST_FROM_REPLICA)
 
 getLatestRevisionId (EntityId $entityId, $mode=LookupConstants::LATEST_FROM_REPLICA)
 
 entityUpdated (EntityRevision $entityRevision)
 Notifies the cache that an Entity was created or updated. More...
 
 redirectUpdated (EntityRedirect $entityRedirect, $revisionId)
 Notifies the cache that a redirect was created or updated. More...
 
 entityDeleted (EntityId $entityId)
 Notifies the cache that an Entity or redirect was deleted. More...
 

Private Member Functions

 fetchEntityRevision (EntityId $entityId, $revisionId, $mode)
 Fetches the EntityRevision and updates the cache accordingly. More...
 

Private Attributes

 $entityRevisionCache
 
 $lookup
 
 $cacheRetrievingLookup
 
 $shouldVerifyRevision = false
 

Detailed Description

Implementation of EntityLookup that caches the obtained entities.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\CachingEntityRevisionLookup::__construct ( EntityRevisionCache  $entityRevisionCache,
EntityRevisionLookup  $entityRevisionLookup 
)

Member Function Documentation

◆ entityDeleted()

Wikibase\Lib\Store\CachingEntityRevisionLookup::entityDeleted ( EntityId  $entityId)

Notifies the cache that an Entity or redirect was deleted.

Parameters
EntityId$entityId

Implements Wikibase\Lib\Store\EntityStoreWatcher.

◆ entityUpdated()

Wikibase\Lib\Store\CachingEntityRevisionLookup::entityUpdated ( EntityRevision  $entityRevision)

Notifies the cache that an Entity was created or updated.

Parameters
EntityRevision$entityRevision

Implements Wikibase\Lib\Store\EntityStoreWatcher.

◆ fetchEntityRevision()

Wikibase\Lib\Store\CachingEntityRevisionLookup::fetchEntityRevision ( EntityId  $entityId,
  $revisionId,
  $mode 
)
private

Fetches the EntityRevision and updates the cache accordingly.

Parameters
EntityId$entityId
int$revisionId
string$mode
Exceptions
StorageException
Returns
EntityRevision|null

◆ getEntityRevision()

Wikibase\Lib\Store\CachingEntityRevisionLookup::getEntityRevision ( EntityId  $entityId,
  $revisionId = 0,
  $mode = LookupConstants::LATEST_FROM_REPLICA 
)
See also
EntityRevisionLookup::getEntityRevision
Note
If this lookup is configured to verify revisions, getLatestRevisionId() will be called on the underlying lookup to check whether the cached revision is still the latest. Otherwise, any cached revision will be used if $revisionId=0.
Parameters
EntityId$entityId
int$revisionIdThe desired revision id, or 0 for the latest revision.
string$modeLATEST_FROM_REPLICA, LATEST_FROM_REPLICA_WITH_FALLBACK or LATEST_FROM_MASTER.
Exceptions
StorageException
Returns
EntityRevision|null

Implements Wikibase\Lib\Store\EntityRevisionLookup.

◆ getLatestRevisionId()

Wikibase\Lib\Store\CachingEntityRevisionLookup::getLatestRevisionId ( EntityId  $entityId,
  $mode = LookupConstants::LATEST_FROM_REPLICA 
)
See also
EntityRevisionLookup::getLatestRevisionId
Parameters
EntityId$entityId
string$mode
Returns
LatestRevisionIdResult

Implements Wikibase\Lib\Store\EntityRevisionLookup.

◆ redirectUpdated()

Wikibase\Lib\Store\CachingEntityRevisionLookup::redirectUpdated ( EntityRedirect  $entityRedirect,
  $revisionId 
)

Notifies the cache that a redirect was created or updated.

Parameters
EntityRedirect$entityRedirect
int$revisionId

Implements Wikibase\Lib\Store\EntityStoreWatcher.

◆ setVerifyRevision()

Wikibase\Lib\Store\CachingEntityRevisionLookup::setVerifyRevision (   $shouldVerifyRevision)

Determine whether the revision of the cached entity should be verified against the current revision in the underlying lookup.

Parameters
bool$shouldVerifyRevision

Member Data Documentation

◆ $cacheRetrievingLookup

Wikibase\Lib\Store\CachingEntityRevisionLookup::$cacheRetrievingLookup
private

◆ $entityRevisionCache

Wikibase\Lib\Store\CachingEntityRevisionLookup::$entityRevisionCache
private

◆ $lookup

Wikibase\Lib\Store\CachingEntityRevisionLookup::$lookup
private

◆ $shouldVerifyRevision

Wikibase\Lib\Store\CachingEntityRevisionLookup::$shouldVerifyRevision = false
private

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