MessageGroupCache Class Reference

Caches messages of file based message group source file. More...

List of all members.

Public Member Functions

 __construct ($group, $code= 'en')
 Contructs a new cache object for given group and language code.
 exists ()
 Returns whether cache exists for this language and group.
 getKeys ()
 Returns list of message keys that are stored.
 getTimestamp ()
 Returns timestamp in unix-format about when this cache was first created.
 getUpdateTimestamp ()
 
 get ($key)
 Get an item from the cache.
 create ($created=false)
 Populates the cache from current state of the source file.
 isValid (&$reason=0)
 Checks whether the cache still reflects the source file.

Public Attributes

const NO_SOURCE = 1
const NO_CACHE = 2
const CHANGED = 3

Protected Member Functions

 open ()
 Open the cache for reading.
 close ()
 Close the cache from reading.
 getCacheFileName ()
 Returns full path the the cache file.
 updateCacheFormat ($oldcache)
 Updates cache to cache format 2.

Protected Attributes

 $group
 $cache
 $code

Detailed Description

Caches messages of file based message group source file.

Can also track that the cache is up to date. Parsing the source files can be slow, so constructing CDB cache makes accessing that data constant speed regardless of the actual format.

Definition at line 18 of file MessageGroupCache.php.


Constructor & Destructor Documentation

MessageGroupCache::__construct ( group,
code = 'en' 
)

Contructs a new cache object for given group and language code.

Parameters:
string|FileBasedMessageGroup $group Group object or id.
string $code Language code. Default value 'en'.

Definition at line 43 of file MessageGroupCache.php.

Here is the call graph for this function:


Member Function Documentation

MessageGroupCache::close (  )  [protected]

Close the cache from reading.

Definition at line 230 of file MessageGroupCache.php.

Referenced by create(), and open().

MessageGroupCache::create ( created = false  ) 

Populates the cache from current state of the source file.

Parameters:
bool|string $created Unix timestamp when the cache is created (for automatic updates).

Definition at line 97 of file MessageGroupCache.php.

Referenced by isValid().

Here is the call graph for this function:

MessageGroupCache::exists (  ) 

Returns whether cache exists for this language and group.

Returns:
bool

Definition at line 56 of file MessageGroupCache.php.

Referenced by create(), and isValid().

Here is the call graph for this function:

MessageGroupCache::get ( key  ) 

Get an item from the cache.

Parameters:
string $key
Returns:
string

Definition at line 89 of file MessageGroupCache.php.

Here is the call graph for this function:

MessageGroupCache::getCacheFileName (  )  [protected]

Returns full path the the cache file.

Returns:
string

Definition at line 241 of file MessageGroupCache.php.

Referenced by create(), exists(), open(), and updateCacheFormat().

Here is the call graph for this function:

MessageGroupCache::getKeys (  ) 

Returns list of message keys that are stored.

Returns:
string[] Message keys that can be passed one-by-one to get() method.

Definition at line 64 of file MessageGroupCache.php.

Here is the call graph for this function:

MessageGroupCache::getTimestamp (  ) 

Returns timestamp in unix-format about when this cache was first created.

Returns:
string Unix timestamp.

Definition at line 72 of file MessageGroupCache.php.

Here is the call graph for this function:

MessageGroupCache::getUpdateTimestamp (  ) 

..

Returns:
string Unix timestamp.

Definition at line 80 of file MessageGroupCache.php.

Here is the call graph for this function:

MessageGroupCache::isValid ( &$  reason = 0  ) 

Checks whether the cache still reflects the source file.

It uses multiple conditions to speed up the checking from file modification timestamps to hashing.

Parameters:
int $reason
Returns:
bool Whether the cache is up to date.

Definition at line 136 of file MessageGroupCache.php.

Here is the call graph for this function:

MessageGroupCache::open (  )  [protected]

Open the cache for reading.

Returns:
MessageGroupCache

Definition at line 213 of file MessageGroupCache.php.

Referenced by create(), get(), getKeys(), getTimestamp(), getUpdateTimestamp(), and updateCacheFormat().

Here is the call graph for this function:

MessageGroupCache::updateCacheFormat ( oldcache  )  [protected]

Updates cache to cache format 2.

Parameters:
CdbReader $oldcache

Definition at line 251 of file MessageGroupCache.php.

Referenced by open().

Here is the call graph for this function:


Member Data Documentation

MessageGroupCache::$cache [protected]

Definition at line 31 of file MessageGroupCache.php.

Referenced by create(), isValid(), and updateCacheFormat().

MessageGroupCache::$code [protected]

Definition at line 36 of file MessageGroupCache.php.

Referenced by __construct().

MessageGroupCache::$group [protected]

Definition at line 26 of file MessageGroupCache.php.

Referenced by __construct(), and isValid().

Definition at line 21 of file MessageGroupCache.php.

Definition at line 19 of file MessageGroupCache.php.


The documentation for this class was generated from the following file:
Generated on Tue Oct 29 00:00:49 2013 for MediaWiki Translate Extension by  doxygen 1.6.3