[-] Core: Change cache key name of objectmodel now using classname against table name #PSCFV-7795

This commit is contained in:
Rémi Gaillard
2013-02-18 10:56:00 +01:00
parent f593ec5b8a
commit 8ab6c87df0
+4 -5
View File
@@ -191,7 +191,7 @@ abstract class ObjectModelCore
if ($id) if ($id)
{ {
// Load object from database if object id is present // Load object from database if object id is present
$cache_id = 'objectmodel_'.$this->def['table'].'_'.(int)$id.'_'.(int)$id_shop.'_'.(int)$id_lang; $cache_id = 'objectmodel_'.$this->def['classname'].'_'.(int)$id.'_'.(int)$id_shop.'_'.(int)$id_lang;
if (!Cache::isStored($cache_id)) if (!Cache::isStored($cache_id))
{ {
$sql = new DbQuery(); $sql = new DbQuery();
@@ -615,7 +615,6 @@ abstract class ObjectModelCore
else else
$all_fields = $fields; $all_fields = $fields;
foreach ($id_shop_list as $id_shop) foreach ($id_shop_list as $id_shop)
{ {
$fields['id_shop'] = (int)$id_shop; $fields['id_shop'] = (int)$id_shop;
@@ -1159,9 +1158,9 @@ abstract class ObjectModelCore
public function clearCache($all = false) public function clearCache($all = false)
{ {
if ($all) if ($all)
Cache::clean('objectmodel_'.$this->def['table'].'_*'); Cache::clean('objectmodel_'.$this->def['classname'].'_*');
else if ($this->id) elseif ($this->id)
Cache::clean('objectmodel_'.$this->def['table'].'_'.(int)$this->id.'_*'); Cache::clean('objectmodel_'.$this->def['classname'].'_'.(int)$this->id.'_*');
} }
/** /**