Caches messages of file based message group source file. More...
Public Member Functions | |
__construct (FileBasedMessageGroup $group, string $code, string $cacheFilePath) | |
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. | |
getAuthors () | |
Get a list of authors. | |
getExtra () | |
Get other data cached from the FFS class. | |
create ( $created=false) | |
Populates the cache from current state of the source file. | |
isValid (&$reason) | |
Checks whether the cache still reflects the source file. | |
invalidate () | |
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. | |
getCacheFilePath () | |
Returns full path to the cache file. | |
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. This also avoid having to deal with potentially unsafe external files during web requests.
Definition at line 20 of file MessageGroupCache.php.
MessageGroupCache::__construct | ( | FileBasedMessageGroup | $group, |
string | $code, | ||
string | $cacheFilePath ) |
Contructs a new cache object for given group and language code.
FileBasedMessageGroup | $group | |
string | $code | Language code. |
string | $cacheFilePath |
Definition at line 40 of file MessageGroupCache.php.
|
protected |
Close the cache from reading.
Definition at line 274 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 128 of file MessageGroupCache.php.
MessageGroupCache::exists | ( | ) |
Returns whether cache exists for this language and group.
Definition at line 54 of file MessageGroupCache.php.
MessageGroupCache::get | ( | $key | ) |
Get an item from the cache.
string | $key |
Definition at line 99 of file MessageGroupCache.php.
MessageGroupCache::getAuthors | ( | ) |
Get a list of authors.
Definition at line 108 of file MessageGroupCache.php.
|
protected |
Returns full path to the cache file.
Definition at line 285 of file MessageGroupCache.php.
MessageGroupCache::getExtra | ( | ) |
Get other data cached from the FFS class.
Definition at line 119 of file MessageGroupCache.php.
MessageGroupCache::getKeys | ( | ) |
Returns list of message keys that are stored.
Definition at line 62 of file MessageGroupCache.php.
MessageGroupCache::getTimestamp | ( | ) |
Returns timestamp in unix-format about when this cache was first created.
Definition at line 82 of file MessageGroupCache.php.
MessageGroupCache::getUpdateTimestamp | ( | ) |
MessageGroupCache::invalidate | ( | ) |
Definition at line 239 of file MessageGroupCache.php.
MessageGroupCache::isValid | ( | & | $reason | ) |
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 166 of file MessageGroupCache.php.
|
protected |
|
protected |
Definition at line 28 of file MessageGroupCache.php.
|
protected |
Definition at line 30 of file MessageGroupCache.php.
|
protected |
Definition at line 26 of file MessageGroupCache.php.
const MessageGroupCache::CHANGED = 3 |
Definition at line 23 of file MessageGroupCache.php.
const MessageGroupCache::NO_CACHE = 2 |
Definition at line 22 of file MessageGroupCache.php.
const MessageGroupCache::NO_SOURCE = 1 |
Definition at line 21 of file MessageGroupCache.php.