Caches messages of file based message group source file. More...
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 |
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.
MessageGroupCache::__construct | ( | $ | group, | |
$ | code = 'en' | |||
) |
Contructs a new cache object for given group and language code.
string|FileBasedMessageGroup | $group Group object or id. | |
string | $code Language code. Default value 'en'. |
Definition at line 43 of file MessageGroupCache.php.
MessageGroupCache::close | ( | ) | [protected] |
Close the cache from reading.
Definition at line 230 of file MessageGroupCache.php.
MessageGroupCache::create | ( | $ | created = false |
) |
Populates the cache from current state of the source file.
bool|string | $created Unix timestamp when the cache is created (for automatic updates). |
Definition at line 97 of file MessageGroupCache.php.
Referenced by isValid().
MessageGroupCache::exists | ( | ) |
Returns whether cache exists for this language and group.
Definition at line 56 of file MessageGroupCache.php.
Referenced by create(), and isValid().
MessageGroupCache::get | ( | $ | key | ) |
Get an item from the cache.
string | $key |
Definition at line 89 of file MessageGroupCache.php.
MessageGroupCache::getCacheFileName | ( | ) | [protected] |
Returns full path the the cache file.
Definition at line 241 of file MessageGroupCache.php.
Referenced by create(), exists(), open(), and updateCacheFormat().
MessageGroupCache::getKeys | ( | ) |
Returns list of message keys that are stored.
Definition at line 64 of file MessageGroupCache.php.
MessageGroupCache::getTimestamp | ( | ) |
Returns timestamp in unix-format about when this cache was first created.
Definition at line 72 of file MessageGroupCache.php.
MessageGroupCache::getUpdateTimestamp | ( | ) |
..
Definition at line 80 of file MessageGroupCache.php.
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.
int | $reason |
Definition at line 136 of file MessageGroupCache.php.
MessageGroupCache::open | ( | ) | [protected] |
Open the cache for reading.
Definition at line 213 of file MessageGroupCache.php.
Referenced by create(), get(), getKeys(), getTimestamp(), getUpdateTimestamp(), and updateCacheFormat().
MessageGroupCache::updateCacheFormat | ( | $ | oldcache | ) | [protected] |
Updates cache to cache format 2.
CdbReader | $oldcache |
Definition at line 251 of file MessageGroupCache.php.
Referenced by open().
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().
const MessageGroupCache::CHANGED = 3 |
Definition at line 21 of file MessageGroupCache.php.
const MessageGroupCache::NO_CACHE = 2 |
Definition at line 20 of file MessageGroupCache.php.
Referenced by ProcessMessageChanges::addMessageUpdateChanges().
const MessageGroupCache::NO_SOURCE = 1 |
Definition at line 19 of file MessageGroupCache.php.