public function i18n_string_textgroup_cached::__construct in Internationalization 7
Extends the existing constructor with a cache handling.
Parameters
string $textgroup: The name of this textgroup.
Overrides i18n_string_textgroup_default::__construct
File
- i18n_string/
i18n_string.inc, line 1379 - API for internationalization strings
Class
- i18n_string_textgroup_cached
- Textgroup handler for i18n_string API which integrated persistent caching.
Code
public function __construct($textgroup) {
parent::__construct($textgroup);
// Fetch persistent caches, the persistent caches contain only metadata.
// Those metadata are processed by the related cache_get() methods.
foreach (array(
'cache_multiple',
'strings',
) as $caches_type) {
if (($cache = cache_get('i18n:string:tgroup:' . $this->textgroup . ':' . $caches_type)) && !empty($cache->data)) {
$this->{$caches_type} = $cache->data;
}
}
}