[+] Classes: add local cache system

This commit is contained in:
rMalie
2011-11-29 09:55:21 +00:00
parent 9415512293
commit 59c23d904d
3 changed files with 35 additions and 14 deletions
+9 -7
View File
@@ -214,14 +214,16 @@ class CountryCore extends ObjectModel
*/
public static function getNameById($id_lang, $id_country)
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `name`
FROM `'._DB_PREFIX_.'country_lang`
WHERE `id_lang` = '.(int)$id_lang.'
AND `id_country` = '.(int)$id_country
);
$key = $id_country.'_'.$id_lang;
if (!Cache::isStored($key))
Cache::store($key, Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `name`
FROM `'._DB_PREFIX_.'country_lang`
WHERE `id_lang` = '.(int)$id_lang.'
AND `id_country` = '.(int)$id_country
));
return $result['name'];
return Cache::retrieve($key);
}
/**