public function testCleanModeMatchingAnyTags4() { $this->_instance->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('tag1', 'tag4')); $this->assertFalse(!!$this->_instance->load('bar')); $this->assertFalse(!!$this->_instance->load('bar2')); $this->assertTrue(!!$this->_instance->load('bar3')); }
public function testCleanModeMatchingAnyTags6() { $tags = array(); for ($i = 0; $i < self::LUA_MAX_C_STACK * 5; $i++) { $tags[] = 'baz' . $i; } $this->_instance->save('foo', 'foo', $tags); $_tags = array(end($tags)); $this->assertEquals(1, count($this->_instance->getIdsMatchingAnyTags($_tags))); $this->_instance->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $_tags); $this->assertEquals(0, count($this->_instance->getIdsMatchingAnyTags($_tags))); }
/** * This method will dispatch the event 'jv_clean_backend_cache'. * Event listeners can change the mode or tags. * * {@inheritdoc} */ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array()) { $transportObject = new Varien_Object(); /** @noinspection PhpUndefinedMethodInspection */ $transportObject->setMode($mode); /** @noinspection PhpUndefinedMethodInspection */ $transportObject->setTags($tags); Mage::dispatchEvent('jv_clean_backend_cache', array('transport' => $transportObject)); /** @noinspection PhpUndefinedMethodInspection */ $mode = $transportObject->getMode(); /** @noinspection PhpUndefinedMethodInspection */ $tags = $transportObject->getTags(); return parent::clean($mode, $tags); }
/** * This method will dispatch the events 'magehost_clean_backend_cache_before' * and 'magehost_clean_backend_cache_after'. * Event listeners can change the mode or tags. * This method will return false when clean failed. * * {@inheritdoc} */ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array()) { $result = false; $transportObject = new Varien_Object(); /** @noinspection PhpUndefinedMethodInspection */ $transportObject->setMode($mode); /** @noinspection PhpUndefinedMethodInspection */ $transportObject->setTags($tags); Mage::dispatchEvent('jv_clean_backend_cache', array('transport' => $transportObject)); // deprecated Mage::dispatchEvent('magehost_clean_backend_cache_before', array('transport' => $transportObject)); /** @noinspection PhpUndefinedMethodInspection */ $mode = $transportObject->getMode(); /** @noinspection PhpUndefinedMethodInspection */ $tags = $transportObject->getTags(); if ($this->works) { try { $result = parent::clean($mode, $tags); } catch (CredisException $e) { $this->processRedisException($e, 'remove'); $result = false; } catch (RedisException $e) { $this->processRedisException($e, 'remove'); $result = false; } catch (Zend_Cache_Exception $e) { $this->processRedisException($e, 'remove'); $result = false; } } $transportObject->setResult($result); Mage::dispatchEvent('magehost_clean_backend_cache_after', array('transport' => $transportObject)); $result = $transportObject->getResult(); return $result; }