// Merge -> revision 8952

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8957 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-10-03 09:14:01 +00:00
parent f1e265fad4
commit ef17d0b7da
44 changed files with 622 additions and 366 deletions
+7 -5
View File
@@ -98,15 +98,17 @@ class CacheFSCore extends Cache {
public function setQuery($query, $result)
{
$md5_query = md5($query);
if (isset($this->_keysCached[$md5_query]))
return true;
if ($this->isBlacklist($query))
return true;
$this->_setKeys();
if (isset($this->_keysCached[$md5_query]))
return true;
$key = $this->set($md5_query, $result);
if (preg_match_all('/('._DB_PREFIX_.'[a-z_-]*)`?.*/i', $query, $res))
foreach($res[1] AS $table)
if(!isset($this->_tablesCached[$table][$key]))
$this->_tablesCached[$table][$key] = true;
$this->_writeKeys();
}
public function delete($key, $timeout = 0)
@@ -126,7 +128,7 @@ class CacheFSCore extends Cache {
public function deleteQuery($query)
{
$this->_setKeys();
if (preg_match_all('/('._DB_PREFIX_.'[a-z_-]*)`?.*/i', $query, $res))
foreach ($res[1] AS $table)
if (isset($this->_tablesCached[$table]))
@@ -138,15 +140,15 @@ class CacheFSCore extends Cache {
}
unset($this->_tablesCached[$table]);
}
$this->_writeKeys();
}
public function flush()
{
}
public function __destruct()
private function _writeKeys()
{
parent::__destruct();
@file_put_contents($this->getPath().'keysCached', serialize($this->_keysCached));
@file_put_contents($this->getPath().'tablesCached', serialize($this->_tablesCached));