MediaWiki  master
LCStoreDB Class Reference

LCStore implementation which uses the standard DB functions to store data. More...

Inheritance diagram for LCStoreDB:
Collaboration diagram for LCStoreDB:

Public Member Functions

 __construct ( $params)
 
 finishWrite ()
 Finish a write transaction. More...
 
 get ( $code, $key)
 Get a value. More...
 
 set ( $key, $value)
 Set a key to a given value. More...
 
 startWrite ( $code)
 Start a write transaction. More...
 

Private Member Functions

 getWriteConnection ()
 

Private Attributes

array $batch = []
 Rows buffered for insertion. More...
 
string null $code
 Language code. More...
 
IDatabase null $dbw
 
bool $readOnly = false
 Whether the DB is read-only or otherwise unavailable for writes. More...
 
array $server
 Server configuration map. More...
 
bool $writesDone = false
 Whether a batch of writes were recently written. More...
 

Detailed Description

LCStore implementation which uses the standard DB functions to store data.

This will work on any MediaWiki installation.

Definition at line 30 of file LCStoreDB.php.

Constructor & Destructor Documentation

◆ __construct()

LCStoreDB::__construct (   $params)

Definition at line 46 of file LCStoreDB.php.

Member Function Documentation

◆ finishWrite()

◆ get()

LCStoreDB::get (   $code,
  $key 
)

Get a value.

Parameters
string$codeLanguage code
string$keyCache key

Implements LCStore.

Definition at line 50 of file LCStoreDB.php.

References $code, DB_REPLICA, getWriteConnection(), unserialize(), and wfGetDB().

◆ getWriteConnection()

LCStoreDB::getWriteConnection ( )
private
Returns
IDatabase

Definition at line 133 of file LCStoreDB.php.

References $dbw, DB_PRIMARY, and wfGetDB().

Referenced by finishWrite(), get(), set(), and startWrite().

◆ set()

LCStoreDB::set (   $key,
  $value 
)

Set a key to a given value.

startWrite() must be called before this is called, and finishWrite() must be called afterwards.

Parameters
string$key
mixed$value

Implements LCStore.

Definition at line 114 of file LCStoreDB.php.

References $code, $dbw, Wikimedia\Rdbms\IDatabase\encodeBlob(), getWriteConnection(), and serialize().

◆ startWrite()

LCStoreDB::startWrite (   $code)

Start a write transaction.

Parameters
string$codeLanguage code

Implements LCStore.

Definition at line 70 of file LCStoreDB.php.

References $code, $dbw, getWriteConnection(), and Wikimedia\Rdbms\IDatabase\isReadOnly().

Member Data Documentation

◆ $batch

array LCStoreDB::$batch = []
private

Rows buffered for insertion.

Definition at line 37 of file LCStoreDB.php.

◆ $code

string null LCStoreDB::$code
private

Language code.

Definition at line 32 of file LCStoreDB.php.

Referenced by get(), set(), and startWrite().

◆ $dbw

IDatabase null LCStoreDB::$dbw
private

Definition at line 40 of file LCStoreDB.php.

Referenced by finishWrite(), getWriteConnection(), set(), and startWrite().

◆ $readOnly

bool LCStoreDB::$readOnly = false
private

Whether the DB is read-only or otherwise unavailable for writes.

Definition at line 44 of file LCStoreDB.php.

◆ $server

array LCStoreDB::$server
private

Server configuration map.

Definition at line 34 of file LCStoreDB.php.

◆ $writesDone

bool LCStoreDB::$writesDone = false
private

Whether a batch of writes were recently written.

Definition at line 42 of file LCStoreDB.php.


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