// Improve performance

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14042 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-03-12 14:50:56 +00:00
parent b542939c9f
commit 951d49d00d
4 changed files with 19 additions and 11 deletions
+8 -6
View File
@@ -293,12 +293,14 @@ class AddressCore extends ObjectModel
*/
public static function addressExists($id_address)
{
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `id_address`
FROM '._DB_PREFIX_.'address a
WHERE a.`id_address` = '.(int)$id_address);
return isset($row['id_address']);
$key = 'address_exists_'.(int)$id_address;
if (!Cache::isStored($key))
Cache::store(
$key, Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `id_address`
FROM '._DB_PREFIX_.'address a
WHERE a.`id_address` = '.(int)$id_address));
return Cache::retrieve($key);
}
public static function getFirstCustomerAddressId($id_customer, $active = true)