[+] 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:
rMalie
2011-11-29 09:55:21 +00:00
parent 9ca2fe4ca5
commit 2cba5f3e1a
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);
}
/**