// Improve performance

This commit is contained in:
rGaillard
2012-03-12 14:50:56 +00:00
parent 0a3ed0b9eb
commit 3d0ccb91eb
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)