当前位置: 首页>>代码示例>>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;未经允许,请勿转载。