Varien_Cache_Core overrides both Zend_Cache_Core::getIdsMatchingTags() and Zend_Cache_Core::getIdsNotMatchingTags() to transform passed $tags before passing them to Zend_Cache_Core methods. However Zend_Cache_Core::getIdsMatchingAnyTags() doesn't get the same treatment and is not overriden which results in not cache not being flushed properly (unless the class that extends Varien_Cache_Core does it itself). Is this a bug or is there some reason behind it?

For example while saving a product through backend Mage_Catalog_Model_Product::CACHE_TAG tag should be flushed, however due to use of vanilla Zend_Cache_Core::getIdsMatchingAnyTags() the tag isn't properly handled and nothing is found.

Sample code

Tested using Cm_Cache_Backend_Redis as cache backend.

require_once 'app/Mage.php';

$cache = Mage::app()->getCache();

$cache->save("test", "test_id_1", ["ALL_TEST_THINGS"]);

$ids = $cache->getIdsMatchingTags(['ALL_TEST_THINGS']);
echo "<h1>Calling getIdsMatchingTags()</h1>";
echo "<pre>" . var_export($ids, TRUE) . "</pre>";

$ids = $cache->getIdsMatchingAnyTags(['ALL_TEST_THINGS']);
echo "<h1>Calling getIdsMatchingAnyTags()</h1>";
echo "<pre>" . var_export($ids, TRUE) . "</pre>";


Calling getIdsMatchingTags()

array (
  0 => 'test_id_1',

Calling getIdsMatchingAnyTags()

array (

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.