當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Translate_Adapter::setCache方法代碼示例

本文整理匯總了PHP中Zend_Translate_Adapter::setCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Translate_Adapter::setCache方法的具體用法?PHP Zend_Translate_Adapter::setCache怎麽用?PHP Zend_Translate_Adapter::setCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Translate_Adapter的用法示例。


在下文中一共展示了Zend_Translate_Adapter::setCache方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTranslate

 /**
  * Retrieve translate object
  *
  * @throws Zend_Application_Resource_Exception if registry key was used
  *          already but is no instance of Zend_Translate
  * @return Zend_Translate
  */
 public function getTranslate()
 {
     if (null === $this->_translate) {
         $this->buildLog();
         // retrieve cache if requested
         if (isset($this->_options['cacheEnabled']) && $this->_options['cacheEnabled']) {
             // check for cachemanager in bootstrap
             if (!$this->getBootstrap()->hasPluginResource('cachemanager')) {
                 throw new Zend_Application_Resource_Exception("You must configure the cachemanager with " . "the key {$this->getCacheKey()}");
             }
             // bootstrap the cachemanager and retrieve it
             /** @var $cacheManager Zend_Cache_Manager */
             $cacheManager = $this->getBootstrap()->bootstrap('cachemanager')->getResource('cachemanager');
             // check for the given key
             if (!$cacheManager->hasCache($this->getCacheKey())) {
                 throw new Zend_Application_Resource_Exception("You must configure the cachemanager with " . "the key {$this->getCacheKey()}");
             }
             // set cache for translator
             Zend_Translate_Adapter::setCache($cacheManager->getCache($this->getCacheKey()));
         }
         // fetch translate object into local variable
         $this->_translate = parent::getTranslate();
     }
     return $this->_translate;
 }
開發者ID:JellyBellyDev,項目名稱:zle,代碼行數:32,代碼來源:Translate.php

示例2: tearDown

 protected function tearDown()
 {
     // restore static variables
     if (isset($this->cache)) {
         Zend_Translate_Adapter::setCache($this->cache);
         unset($this->cache);
     } else {
         Zend_Translate_Adapter::removeCache();
     }
     // unset the registry
     Zend_Registry::_unsetInstance();
 }
開發者ID:JellyBellyDev,項目名稱:zle,代碼行數:12,代碼來源:TranslateTest.php

示例3: setCache

 /**
  * Sets a cache for all instances of Zend_Translate
  *
  * @param  Zend_Cache_Core $cache Cache to store to
  * @return void
  */
 public static function setCache(Zend_Cache_Core $cache)
 {
     Zend_Translate_Adapter::setCache($cache);
 }
開發者ID:JaroslavRamba,項目名稱:ex-facebook-bundle,代碼行數:10,代碼來源:Translate.php


注:本文中的Zend_Translate_Adapter::setCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。