[+] Classes: add local cache system
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10729 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+9
-7
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user