Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
SerializedMessageIndex Class Reference

Storage on serialized file. More...

Inheritance diagram for SerializedMessageIndex:
MessageIndex

Public Member Functions

 retrieve ( $forRebuild=false)
 
- Public Member Functions inherited from MessageIndex
 getKeys ()
 
 rebuild (float $timestamp=null)
 Creates the index from scratch.
 
 getStatusCacheKey ()
 
 storeInterim (MessageGroup $group, array $newKeys)
 

Protected Member Functions

 store (array $array, array $diff)
 
- Protected Member Functions inherited from MessageIndex
 get ( $key)
 Looks up the stored value for single key.
 
 lock ()
 
 unlock ()
 
 clearMessageGroupStats (array $diff)
 Purge stuff when set of keys have changed.
 
 checkAndAdd (&$hugearray, MessageGroup $g, $ignore=false)
 
 serialize ( $data)
 These are probably slower than serialize and unserialize, but they are more space efficient because we only need strings and arrays.
 
 unserialize ( $data)
 

Protected Attributes

 $index
 
 $filename = 'translate_messageindex.ser'
 
- Protected Attributes inherited from MessageIndex
 $interimCache
 

Additional Inherited Members

- Static Public Member Functions inherited from MessageIndex
static singleton ()
 
static setInstance (self $instance)
 Override the global instance, for testing.
 
static getGroupIds (MessageHandle $handle)
 Retrieves a list of groups given MessageHandle belongs to.
 
static getPrimaryGroupId (MessageHandle $handle)
 
static getArrayDiff (array $old, array $new)
 Compares two associative arrays.
 
- Static Protected Attributes inherited from MessageIndex
static $instance
 

Detailed Description

Storage on serialized file.

This serializes the whole array. Because this format can preserve the values which are stored as references inside the array, this is the most space efficient storage method and fastest when you want the full index.

Unfortunately when the size of index grows to about 50000 items, even though it is only 3,5M on disk, it takes 35M when loaded into memory and the loading can take more than 0,5 seconds. Because usually we need to look up only few keys, it is better to use another backend which provides random access - this backend doesn't support that.

Definition at line 463 of file MessageIndex.php.

Member Function Documentation

◆ retrieve()

SerializedMessageIndex::retrieve ( $forRebuild = false)
Parameters
bool$forRebuild
Returns
array

Reimplemented from MessageIndex.

Definition at line 472 of file MessageIndex.php.

◆ store()

SerializedMessageIndex::store ( array $array,
array $diff )
protected

Reimplemented from MessageIndex.

Definition at line 487 of file MessageIndex.php.

Member Data Documentation

◆ $filename

SerializedMessageIndex::$filename = 'translate_messageindex.ser'
protected

Definition at line 466 of file MessageIndex.php.

◆ $index

SerializedMessageIndex::$index
protected

Definition at line 465 of file MessageIndex.php.


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