MediaWiki master
MediaWiki\Block\BlockCacheKey Class Reference

Public Member Functions

 __construct (?WebRequest $request, UserIdentity $user, bool $fromPrimary)
 
 __toString ()
 Convert to a string, for debugging.
 
 getPartialKey ()
 Get the bucket for the cache entry associated with this key.
 
 isUser (UserIdentity $user)
 Determine whether the specified user is the user stored in the key.
 
 matchesStored (self $storedKey)
 Determine whether a new key matches a stored key sufficiently well to allow the stored cache entry to be returned.
 

Detailed Description

Access: internal
For use by BlockManager

Definition at line 12 of file BlockCacheKey.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\BlockCacheKey::__construct ( ?WebRequest $request,
UserIdentity $user,
bool $fromPrimary )
Parameters
WebRequest | null$request
UserIdentity$user
bool$fromPrimary

Definition at line 29 of file BlockCacheKey.php.

References MediaWiki\User\UserIdentity\getId().

Member Function Documentation

◆ __toString()

MediaWiki\Block\BlockCacheKey::__toString ( )

Convert to a string, for debugging.

Returns
string

Definition at line 125 of file BlockCacheKey.php.

◆ getPartialKey()

MediaWiki\Block\BlockCacheKey::getPartialKey ( )

Get the bucket for the cache entry associated with this key.

Entries with the same partial key will replace each other in the cache.

Returns
string

Definition at line 82 of file BlockCacheKey.php.

Referenced by MediaWiki\Block\BlockCache\set().

◆ isUser()

MediaWiki\Block\BlockCacheKey::isUser ( UserIdentity $user)

Determine whether the specified user is the user stored in the key.

This is used for cache invalidation.

If the WeakReference has expired, it is not possible to serve a cache hit for the user, so that is considered to be a mismatch.

Parameters
UserIdentity$user
Returns
bool

Definition at line 99 of file BlockCacheKey.php.

◆ matchesStored()

MediaWiki\Block\BlockCacheKey::matchesStored ( self $storedKey)

Determine whether a new key matches a stored key sufficiently well to allow the stored cache entry to be returned.

If a WeakReference in either key has expired, that is considered as a mismatch.

Parameters
BlockCacheKey$storedKey
Returns
bool

Definition at line 64 of file BlockCacheKey.php.


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