MediaWiki master
|
Public Member Functions | |
__construct (ILoadBalancer $dbLoadBalancer, WANObjectCache $cache, LoggerInterface $logger, $table, $idField, $nameField, ?callable $normalizationCallback=null, $dbDomain=false, ?callable $insertCallback=null) | |
acquireId (string $name) | |
Acquire the id of the given name. | |
getId (string $name) | |
Get the id of the given name. | |
getMap () | |
Get the whole table, in no particular order as a map of ids to names. | |
getName (int $id) | |
Get the name of the given id. | |
reloadMap ( $connFlags=0) | |
Reloads the name table from the primary database, and purges the WAN cache entry. | |
Definition at line 36 of file NameTableStore.php.
MediaWiki\Storage\NameTableStore::__construct | ( | ILoadBalancer | $dbLoadBalancer, |
WANObjectCache | $cache, | ||
LoggerInterface | $logger, | ||
$table, | |||
$idField, | |||
$nameField, | |||
?callable | $normalizationCallback = null, | ||
$dbDomain = false, | |||
?callable | $insertCallback = null ) |
ILoadBalancer | $dbLoadBalancer | A load balancer for acquiring database connections |
WANObjectCache | $cache | A cache manager for caching data. This can be the local wiki's default instance even if $dbDomain refers to a different wiki, since makeGlobalKey() is used to constructed a key that allows cached names from the same database to be re-used between wikis. For example, enwiki and frwiki will use the same cache keys for names from the wikidatawiki database, regardless of the cache's default key space. |
LoggerInterface | $logger | |
string | $table | |
string | $idField | |
string | $nameField | |
callable | null | $normalizationCallback | Normalization to be applied to names before being saved or queried. This should be a callback that accepts and returns a single string. |
bool | string | $dbDomain | Database domain ID. Use false for the local database domain. |
callable | null | $insertCallback | Callback to change insert fields accordingly. This parameter was introduced in 1.32 |
Definition at line 85 of file NameTableStore.php.
MediaWiki\Storage\NameTableStore::acquireId | ( | string | $name | ) |
Acquire the id of the given name.
This creates a row in the table if it doesn't already exist.
string | $name |
NameTableAccessException |
Definition at line 159 of file NameTableStore.php.
MediaWiki\Storage\NameTableStore::getId | ( | string | $name | ) |
Get the id of the given name.
If the name doesn't exist this will throw. This should be used in cases where we believe the name already exists or want to check for existence.
string | $name |
NameTableAccessException | The name does not exist |
Definition at line 221 of file NameTableStore.php.
References MediaWiki\Storage\NameTableAccessException\newFromDetails().
MediaWiki\Storage\NameTableStore::getMap | ( | ) |
Get the whole table, in no particular order as a map of ids to names.
This method could be subject to DB or cache lag.
Definition at line 303 of file NameTableStore.php.
MediaWiki\Storage\NameTableStore::getName | ( | int | $id | ) |
Get the name of the given id.
If the id doesn't exist this will throw. This should be used in cases where we believe the id already exists.
Note: Calls to this method will result in a primary DB select for non existing IDs.
int | $id |
NameTableAccessException | The id does not exist |
Definition at line 245 of file NameTableStore.php.
References $source, DB_PRIMARY, DB_REPLICA, Wikimedia\Rdbms\Database\getCacheSetOptions(), and MediaWiki\Storage\NameTableAccessException\newFromDetails().
MediaWiki\Storage\NameTableStore::reloadMap | ( | $connFlags = 0 | ) |
Reloads the name table from the primary database, and purges the WAN cache entry.
int | $connFlags | ILoadBalancer::CONN_XXX flags. Optional. |
Definition at line 201 of file NameTableStore.php.
References DB_PRIMARY.