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

EntityRevisionLookup implementation that checks an EntityRevisionCache for cached revisions (but doesn't cache on its own). More...

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

Public Member Functions

 __construct (EntityRevisionCache $cache, EntityRevisionLookup $lookup)
 
 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)
 Get an EntityRevision from cache or (otherwise) from the underlying EntityRevisionLookup. More...
 
 getEntityRevisionFromCache (EntityId $entityId, $revisionId=0, $mode=LookupConstants::LATEST_FROM_REPLICA)
 Try to get an EntityRevision from cache. More...
 
 getLatestRevisionId (EntityId $entityId, $mode=LookupConstants::LATEST_FROM_REPLICA)
 

Private Attributes

 $cache
 
 $lookup
 
 $shouldVerifyRevision = false
 

Detailed Description

EntityRevisionLookup implementation that checks an EntityRevisionCache for cached revisions (but doesn't cache on its own).

Falls back to a given EntityRevisionLookup.

Author
Daniel Kinzler
Marius Hoch

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\CacheRetrievingEntityRevisionLookup::__construct ( EntityRevisionCache  $cache,
EntityRevisionLookup  $lookup 
)

Member Function Documentation

◆ getEntityRevision()

Wikibase\Lib\Store\CacheRetrievingEntityRevisionLookup::getEntityRevision ( EntityId  $entityId,
  $revisionId = 0,
  $mode = LookupConstants::LATEST_FROM_REPLICA 
)

Get an EntityRevision from cache or (otherwise) from the underlying EntityRevisionLookup.

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$modeOne of the EntityRevisionLookup::LATEST_* constants.
Exceptions
StorageException
Returns
EntityRevision|null

Implements Wikibase\Lib\Store\EntityRevisionLookup.

◆ getEntityRevisionFromCache()

Wikibase\Lib\Store\CacheRetrievingEntityRevisionLookup::getEntityRevisionFromCache ( EntityId  $entityId,
  $revisionId = 0,
  $mode = LookupConstants::LATEST_FROM_REPLICA 
)

Try to get an EntityRevision from cache.

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 Null if the EntityRevision in question is not cached.

◆ getLatestRevisionId()

Wikibase\Lib\Store\CacheRetrievingEntityRevisionLookup::getLatestRevisionId ( EntityId  $entityId,
  $mode = LookupConstants::LATEST_FROM_REPLICA 
)
See also
EntityRevisionLookup::getLatestRevisionId
Note
If this lookup is configured to verify revisions, this just delegates to the underlying lookup. Otherwise, it may return the ID of a cached revision.
Parameters
EntityId$entityId
string$mode
Returns
LatestRevisionIdResult

Implements Wikibase\Lib\Store\EntityRevisionLookup.

◆ setVerifyRevision()

Wikibase\Lib\Store\CacheRetrievingEntityRevisionLookup::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

◆ $cache

Wikibase\Lib\Store\CacheRetrievingEntityRevisionLookup::$cache
private

◆ $lookup

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

◆ $shouldVerifyRevision

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

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