Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6082319
BlockCache.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
BlockCache.php
View Options
<?php
namespace
MediaWiki\Block
;
use
MediaWiki\User\UserIdentity
;
/**
* @internal For use by BlockManager
*/
class
BlockCache
{
/** @var BlockCacheEntry[] The cache entries indexed by partial key */
private
$cache
=
[];
/**
* Get a cached Block for the given key, or null if there is no cache entry,
* or false if there is a cache entry indicating that the given target is
* not blocked.
*
* @param BlockCacheKey $key
* @return AbstractBlock|false|null
*/
public
function
get
(
BlockCacheKey
$key
)
{
$entry
=
$this
->
cache
[
$key
->
getPartialKey
()]
??
null
;
if
(
$entry
===
null
)
{
return
null
;
}
return
$key
->
matchesStored
(
$entry
->
key
)
?
$entry
->
block
:
null
;
}
/**
* Set a block cache entry
*
* @param BlockCacheKey $key The bundled block cache parameters
* @param AbstractBlock|false $value The block, or false to indicate that
* the target is not blocked.
*/
public
function
set
(
BlockCacheKey
$key
,
$value
)
{
$this
->
cache
[
$key
->
getPartialKey
()]
=
new
BlockCacheEntry
(
$key
,
$value
);
}
/**
* Clear all block cache entries associated with a user
*
* @param UserIdentity $user
*/
public
function
clearUser
(
UserIdentity
$user
)
{
foreach
(
$this
->
cache
as
$partialKey
=>
$entry
)
{
if
(
$entry
->
key
->
isUser
(
$user
)
)
{
unset
(
$this
->
cache
[
$partialKey
]
);
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 5 2026, 12:02 (6 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7a/d9/9e7b3734fd9e729782c1d3af8958
Default Alt Text
BlockCache.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment