Skip to content

Commit

Permalink
Added support for flush actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Feb 11, 2024
1 parent b2f4a52 commit 00aeb54
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions app/code/core/Mage/Core/Model/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,14 @@ public function clean($tags = [])
*/
public function flush()
{
return $this->getFrontend()->clean();
$return = $this->getFrontend()->clean();
if ($return) {
foreach ($this->getTypes() as $typeCode => $type) {
$this->saveUpdateAt($typeCode);
}
}

return $return;
}

/**
Expand Down Expand Up @@ -665,18 +672,23 @@ public function cleanType($typeCode)
$tags = $this->getTagsByType($typeCode);
$this->clean($tags);

$path = self::XML_PATH_TYPES . '/' . $typeCode . '/tags';
$tagsConfig = Mage::getConfig()->getNode($path);
if ($tagsConfig) {
$this->save(Mage::getSingleton('core/date')->gmtDate(), (string)$tagsConfig . '_updated_at');
}
$this->saveUpdateAt($typeCode);

$types = $this->_getInvalidatedTypes();
unset($types[$typeCode]);
$this->_saveInvalidatedTypes($types);
return $this;
}

public function saveUpdateAt($typeCode)
{
$path = self::XML_PATH_TYPES . '/' . $typeCode . '/tags';
$tagsConfig = Mage::getConfig()->getNode($path);
if ($tagsConfig) {
$this->save(Mage::getSingleton('core/date')->gmtDate(), (string)$tagsConfig . '_updated_at');
}
}

/**
* Try to get response body from cache storage with predefined processors
*
Expand Down

0 comments on commit 00aeb54

Please sign in to comment.