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


PHP Zend_Cache_Core類代碼示例

本文整理匯總了PHP中Zend_Cache_Core的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Cache_Core類的具體用法?PHP Zend_Cache_Core怎麽用?PHP Zend_Cache_Core使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute($text = null)
 {
     if ($this->cache instanceof \Zend_Cache_Core) {
         $this->cache->clean(\Zend_Cache::CLEANING_MODE_ALL);
         $this->getBatch()->addMessage($this->_('Cache cleaned'));
     }
 }
開發者ID:harmslijper,項目名稱:gemstracker-library,代碼行數:13,代碼來源:CleanCache.php

示例2: testSettingLifetimeAsEmptyIsInterpretedAsNull

 /**
  * @group ZF-9092
  */
 public function testSettingLifetimeAsEmptyIsInterpretedAsNull()
 {
     $config = new Zend_Config(array('lifetime' => '', 'caching' => true));
     $test = new Zend_Cache_Core();
     $test->setConfig($config);
     $this->assertSame(NULL, $test->getOption('lifetime'));
 }
開發者ID:netvlies,項目名稱:zf,代碼行數:10,代碼來源:CoreTest.php

示例3: _getSecondLevelCache

 private function _getSecondLevelCache()
 {
     if (!$this->_secondLevelCache) {
         $c = new Zend_Cache_Core(array('lifetime' => null, 'write_control' => false, 'automatic_cleaning_factor' => 0, 'automatic_serialization' => true));
         $c->setBackend(new Kwf_Cache_Backend_File(array('cache_dir' => 'cache/mediameta', 'hashed_directory_level' => 2)));
         $this->_secondLevelCache = $c;
     }
     return $this->_secondLevelCache;
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:9,代碼來源:MemoryCache.php

示例4: _getCache

 private static function _getCache()
 {
     static $cache;
     if (!isset($cache)) {
         $cache = new Zend_Cache_Core(array('lifetime' => null, 'write_control' => false, 'automatic_cleaning_factor' => 0, 'automatic_serialization' => true));
         $cache->setBackend(new Kwf_Cache_Backend_File(array('cache_dir' => 'cache/commonjs', 'hashed_directory_level' => 2)));
     }
     return $cache;
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:9,代碼來源:Parser.php

示例5: _getSlowCache

 public static function _getSlowCache()
 {
     static $ret;
     if (!isset($ret)) {
         $ret = new Zend_Cache_Core(array('lifetime' => null, 'automatic_serialization' => true, 'automatic_cleaning_factor' => 0, 'write_control' => false));
         $ret->setBackend(new Zend_Cache_Backend_File(array('cache_dir' => 'cache/assets', 'cache_file_perm' => 0666, 'hashed_directory_perm' => 0777, 'hashed_directory_level' => 2)));
     }
     return $ret;
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:9,代碼來源:Cache.php

示例6: find

 public static function find($search_data, array $overrideSources = null)
 {
     $sources = array('local', 'def');
     if (is_array($overrideSources)) {
         $sources = $overrideSources;
     }
     if (self::$_cache !== null && is_scalar($search_data) && is_numeric($search_data)) {
         $cached = self::$_cache->load(__CLASS__ . implode('_', $sources) . $search_data);
         if ($cached !== false) {
             return $cached;
         }
     }
     $found = array();
     foreach ($sources as $source) {
         $sourceObject = self::getSource($source);
         $founded_temp = self::findInSource($search_data, is_array($search_data) ? self::detectCustomerType($search_data) : '', $sourceObject);
         if (count($founded_temp) > 0) {
             $found = array_merge($found, $founded_temp);
         }
     }
     if (self::$_cache !== null && is_scalar($search_data) && count($found) == 1 && is_numeric($search_data)) {
         self::$_cache->save($found, __CLASS__ . implode('_', $sources) . $search_data);
     }
     return $found;
 }
開發者ID:knatorski,項目名稱:SMS,代碼行數:25,代碼來源:Customer.php

示例7: cacheOrParserPdfWithFPDI

 /**
  * Recupera parser do Pdf: faz o parser em tempo real ou recupera do cache
  * 
  * @param string $arqInsert
  * @return fpdi_pdf_parser
  */
 public function cacheOrParserPdfWithFPDI($pagePdf, $pathArquivoPdf)
 {
     //try {
     //verifica parser do Pdf no cache
     $parserPdfCache = $this->cache->load($pagePdf);
     $origem = "--->parserPdf vem do cache---";
     $this->objMakePdf->current_filename = $pathArquivoPdf;
     //recupera do cache
     if ($parserPdfCache == false) {
         //tento fazer o parser do pdf
         $parserPdfCache = $this->objMakePdf->_getPdfParser($pathArquivoPdf);
         //salvo o parser do pdf no cache
         $this->cache->save($parserPdfCache, $pagePdf);
         $origem = "--->parserPdf NAO vem do cache---";
     } else {
         //grava parser pdf no var do objeto FPDI
         $this->objMakePdf->parsers[$pathArquivoPdf] = $parserPdfCache;
     }
     echo $origem;
     $this->setCacheYesOrNo($origem);
     $result = true;
     //} catch (Exception $e) {
     //    throw new Exception("There is a problem at PDF parser process");
     //    $result = false;
     // }
     return $result;
 }
開發者ID:Lazaro-Gallo,項目名稱:psmn,代碼行數:33,代碼來源:InsertPdf.php

示例8: __destruct

 /**
  * Save the cache here
  */
 public function __destruct()
 {
     // \MUtil_Echo::track(count($this->_commands));
     if ($this->_commands) {
         $this->_cache->save($this->_commands, $this->_cacheId, array('batch', 'sess_' . session_id()));
     } else {
         $this->_cache->remove($this->_cacheId);
     }
 }
開發者ID:GemsTracker,項目名稱:MUtil,代碼行數:12,代碼來源:CacheStack.php

示例9: testTouch

 public function testTouch()
 {
     $this->rediska->set('test', array('aaa', time(), 100));
     $this->rediska->expire('test', 100);
     $reply = $this->cache->touch('test', 200);
     $this->assertTrue($reply);
     $lifetime = $this->rediska->getLifetime('test');
     $this->assertTrue($lifetime > 290);
     $values = $this->rediska->get('test');
     $this->assertEquals(300, $values[2]);
 }
開發者ID:utachkin,項目名稱:Rediska,代碼行數:11,代碼來源:Cache.php

示例10: alternative

 /**
  * 
  */
 public function alternative($alternative_id, Model_Alternative $modelAlternative)
 {
     $nameCache = 'alternative_' . $alternative_id;
     $alternative = $this->cache->load($nameCache);
     $origem = "--->alternative vem do cache---";
     //recupera do cache
     if ($alternative == false) {
         $alternative = $modelAlternative->getAlternativeById($alternative_id);
         $this->cache->save($alternative, $nameCache);
         $origem = "--->alternative NAO vem do cache---";
     }
     return $alternative;
 }
開發者ID:Lazaro-Gallo,項目名稱:psmn,代碼行數:16,代碼來源:QuestionarioCache.php

示例11: fazCacheAcl

 /**
  * metodo chamado em Vtx_Plugin_Permission
  */
 public function fazCacheAcl($sysId = 1)
 {
     if ($sysId == 1) {
         $nameCache = 'acl';
     } else {
         $nameCache = 'acl' . $sysId;
     }
     $acl = $this->cache->load($nameCache);
     if (!$acl) {
         $acl = new Model_Acl(true);
         $this->cache->save($acl, $nameCache);
     }
     return $acl;
 }
開發者ID:Lazaro-Gallo,項目名稱:psmn,代碼行數:17,代碼來源:SiteCache.php

示例12: clean

 /**
  * Remove cache matching id, prefix or tags
  * @param string $cacheId cache id to remove
  * @param string $cachePrefix cache prefix to remove
  * @param array $tags array of cache tags to remove
  */
 public function clean($cacheId = '', $cachePrefix = '', $tags = array())
 {
     $tags = $this->_sanitizeTags($tags);
     $this->_cache->clean(Zend_Cache::CLEANING_MODE_OLD);
     if (!$cachePrefix && !$cacheId) {
         if (is_array($tags) && !empty($tags)) {
             $this->_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $tags);
         } else {
             $this->_cache->clean(Zend_Cache::CLEANING_MODE_ALL);
         }
     } else {
         $cacheId = $this->_makeCacheId($cacheId, $cachePrefix);
         $this->_cache->remove($cacheId);
     }
 }
開發者ID:PavloKovalov,項目名稱:seotoaster,代碼行數:21,代碼來源:Cache.php

示例13: getRedisAdapter

 /**
  * Redis support
  *
  * @return Redis | null
  */
 public function getRedisAdapter()
 {
     if (isset($this->cacheAdapter) && get_class($this->cacheAdapter) == Redis::class) {
         return $this->cacheAdapter->getAdapter();
     }
     return null;
 }
開發者ID:cipherpols,項目名稱:cze,代碼行數:12,代碼來源:CacheManager.php

示例14: _loadConfig

 protected function _loadConfig($file)
 {
     if ($this->_useCache == false) {
         return parent::_loadConfig($file);
     }
     $configMTime = filemtime($file);
     $cacheId = "application_conf_" . md5($file . $this->getEnvironment());
     $cacheLastMTime = $this->_configCache->test($cacheId);
     //Valid cache?
     if ($cacheLastMTime !== false && $configMTime <= $cacheLastMTime) {
         return $this->_configCache->load($cacheId, true);
     }
     $config = parent::_loadConfig($file);
     $this->_configCache->save($config, $cacheId, array(), null);
     return $config;
 }
開發者ID:henvic,項目名稱:MediaLab,代碼行數:16,代碼來源:Application.php

示例15: afterFormValidationFor

 /**
  * Overrule this function for any activities you want to take place
  * after the form has successfully been validated, but before any
  * buttons are processed.
  *
  * @param int $step The current step
  */
 protected function afterFormValidationFor($step)
 {
     if (3 == $step) {
         $import = $this->loadImportData();
         $model = $this->getModel();
         $saves = array();
         foreach ($model->getCol('exportCode') as $name => $exportCode) {
             if (isset($this->formData[$name]) && $this->formData[$name]) {
                 $saves[] = array('gsu_id_survey' => $this->formData[$name], 'gsu_export_code' => $exportCode);
                 $import['surveyCodes'][$exportCode] = $this->formData[$name];
             }
         }
         if ($saves) {
             $sModel = new \MUtil_Model_TableModel('gems__surveys');
             \Gems_Model::setChangeFieldsByPrefix($sModel, 'gus', $this->currentUser->getUserId());
             $sModel->saveAll($saves);
             $count = $sModel->getChanged();
             if ($count == 0) {
                 $this->addMessage($this->_('No export code changed'));
             } else {
                 $this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('surveys'));
                 $this->addMessage(sprintf($this->plural('%d export code changed', '%d export codes changed', $count), $count));
             }
         }
     }
 }
開發者ID:harmslijper,項目名稱:gemstracker-library,代碼行數:33,代碼來源:ImportTrackSnippetAbstract.php


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