public function testClearAll() { $capabilities = $this->_storage->getCapabilities(); if (!$capabilities->getClearAllNamespaces()) { $this->setExpectedException('Zend\\Cache\\Exception'); $this->_storage->clear(Adapter::MATCH_ALL); return; } $items = array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'); $namespaces = array('ns1', 'ns2'); foreach ($namespaces as $ns) { $this->_options->setNamespace($ns); foreach ($items as $k => $v) { $this->assertTrue($this->_storage->setItem($ns . $k, $ns . $v)); } } $this->assertTrue($this->_storage->clear(Adapter::MATCH_ALL)); // wait usleep($capabilities->getTtlPrecision() * 2000000); foreach ($namespaces as $ns) { $this->_options->setNamespace($ns); foreach ($items as $k => $v) { $this->assertFalse($this->_storage->hasItem($ns . $k)); } } }
/** * Clears all set cache data * * @param string $tag Tag to clear when the default tag name is not used * @return void */ public static function clearCache($tag = null) { if (self::$_cacheTags) { if ($tag == null) { $tag = 'Zend_Translator'; } self::$_cache->clear(CacheAdapter::MATCH_TAGS_OR, array('tags' => array($tag))); } else { self::$_cache->clear(CacheAdapter::MATCH_ALL); } }
/** * Clears all set cache data * * @param string $tag Tag to clear when the default tag name is not used * @return void */ public static function clearCache($tag = null) { if (!self::$_cache instanceof CacheAdapter) { return; } if (self::$_cacheTags) { if ($tag == null) { $tag = 'Zend_Locale'; } self::$_cache->clear(CacheAdapter::MATCH_TAGS_OR, array('tags' => array($tag))); } else { self::$_cache->clear(CacheAdapter::MATCH_ALL); } }
public function tearDown() { $this->_cache->clear(CacheAdapter::MATCH_ALL); $this->_cache = null; }
/** * Object destructor * * Clean up backend storage */ public function __destruct() { if ($this->_cache !== null) { $this->_cache->clear(CacheAdapter::MATCH_TAGS_OR, array('tags' => $this->_tags)); } }
public function tearDown() { if ($this->cache) { $this->cache->clear(CacheAdapter::MATCH_ALL); } }