|
MediaWiki master
|
Simple in-memory cache for UserIdentity objects indexed by user ID, actor ID and user name. More...
Public Member Functions | |
| __construct (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 | ( | int | $maxSize | ) |
| int | $maxSize | hold up to this many UserIdentity values |
Definition at line 45 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 74 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 55 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 65 of file ActorCache.php.
| MediaWiki\User\ActorCache::remove | ( | UserIdentity | $actor | ) |
Definition at line 88 of file ActorCache.php.