|
MediaWiki master
|
Simple in-memory cache for UserIdentity objects indexed by user ID, actor ID and user name. More...
Public Member Functions | |
| __construct (private readonly int $maxSize,) | |
| add (int $actorId, UserIdentity $actor) | |
| Add $actor with $actorId to the cache. | |
| clear () | |
| Remove everything from the cache. | |
| getActor (string $keyType, $keyValue) | |
| Get user identity which has $keyType equal to $keyValue. | |
| getActorId (string $keyType, $keyValue) | |
| Get actor ID of the user which has $keyType equal to $keyValue. | |
| remove (UserIdentity $actor) | |
Simple in-memory cache for UserIdentity objects indexed by user ID, actor ID and user name.
We cannot just use MapCacheLRU for this because of eviction semantics: we need to be able to remove UserIdentity from the cache even if user ID or user name has changed, so we track the most accessed VALUES in the cache, not keys, and evict them alongside with all their indexes.
Definition at line 22 of file ActorCache.php.
| MediaWiki\User\ActorCache::__construct | ( | private readonly int | $maxSize | ) |
| int | $maxSize | hold up to this many UserIdentity values |
Definition at line 43 of file ActorCache.php.
| MediaWiki\User\ActorCache::add | ( | int | $actorId, |
| UserIdentity | $actor ) |
Add $actor with $actorId to the cache.
| int | $actorId | |
| UserIdentity | $actor |
Definition at line 73 of file ActorCache.php.
References MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), and MediaWiki\DAO\WikiAwareEntity\getWikiId().
| MediaWiki\User\ActorCache::clear | ( | ) |
| MediaWiki\User\ActorCache::getActor | ( | string | $keyType, |
| $keyValue ) |
Get user identity which has $keyType equal to $keyValue.
| string | $keyType | one of self::KEY_* constants. |
| string | int | $keyValue |
Definition at line 54 of file ActorCache.php.
| MediaWiki\User\ActorCache::getActorId | ( | string | $keyType, |
| $keyValue ) |
Get actor ID of the user which has $keyType equal to $keyValue.
| string | $keyType | one of self::KEY_* constants. |
| string | int | $keyValue |
Definition at line 64 of file ActorCache.php.
| MediaWiki\User\ActorCache::remove | ( | UserIdentity | $actor | ) |
Definition at line 87 of file ActorCache.php.