本文整理汇总了PHP中Zend_Translate::removeCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Translate::removeCache方法的具体用法?PHP Zend_Translate::removeCache怎么用?PHP Zend_Translate::removeCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Translate
的用法示例。
在下文中一共展示了Zend_Translate::removeCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setCache
/**
* Sets the translation cache
*
* @return void
*/
protected function _setCache()
{
$options = $this->getOptions();
// Disable cache? If not defined, cache will be active
if (isset($options['cache']['active']) && !$options['cache']['active']) {
// Explicitly remove cache, in case it was set before
Zend_Translate::removeCache();
return;
}
// Get the cache using the config settings as input
$this->_bootstrap->bootstrap('CacheManager');
$manager = $this->_bootstrap->getResource('CacheManager');
$cache = $manager->getCache('translate');
// Write caching errors to log file (if activated in the config)
$this->_bootstrap->bootstrap('Log');
$logger = $this->_bootstrap->getResource('Log');
$cache->setOption('logger', $logger);
Zend_Translate::setCache($cache);
}
示例2: testTestingCacheHandling
public function testTestingCacheHandling()
{
require_once 'Zend/Cache.php';
$cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 120, 'automatic_serialization' => true), array('cache_dir' => dirname(__FILE__) . '/_files/'));
Zend_Translate::setCache($cache);
$cache = Zend_Translate::getCache();
$this->assertTrue($cache instanceof Zend_Cache_Core);
$this->assertTrue(Zend_Translate::hasCache());
$lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1 (en)'), 'en');
$adapter = $lang->getAdapter();
$this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array);
$adaptercache = $adapter->getCache();
$this->assertTrue($adaptercache instanceof Zend_Cache_Core);
Zend_Translate::clearCache();
$this->assertTrue(Zend_Translate::hasCache());
Zend_Translate::removeCache();
$this->assertFalse(Zend_Translate::hasCache());
}
示例3: testSetCacheFromCacheManager
/**
* @group ZF-10034
*/
public function testSetCacheFromCacheManager()
{
$configCache = array('translate' => array('frontend' => array('name' => 'Core', 'options' => array('lifetime' => 120, 'automatic_serialization' => true)), 'backend' => array('name' => 'Black Hole')));
$this->bootstrap->registerPluginResource('cachemanager', $configCache);
$options = $this->_translationOptions;
$options['cache'] = 'translate';
$resource = new Zend_Application_Resource_Translate($options);
$resource->setBootstrap($this->bootstrap);
$resource->init();
$this->assertTrue(Zend_Translate::getCache() instanceof Zend_Cache_Core);
Zend_Translate::removeCache();
}