当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Cache_Core::save方法代码示例

本文整理汇总了PHP中Zend_Cache_Core::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Core::save方法的具体用法?PHP Zend_Cache_Core::save怎么用?PHP Zend_Cache_Core::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Cache_Core的用法示例。


在下文中一共展示了Zend_Cache_Core::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: __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

示例3: 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

示例4: testSave

 public function testSave()
 {
     $reply = $this->cache->save('aaa', 'test');
     $this->assertTrue($reply);
     $value = $this->rediska->get('test');
     $this->assertTrue(is_array($value));
     $this->assertEquals('aaa', $value[0]);
     $reply = $this->cache->save('aaa', 'test', array(), 2);
     $this->assertTrue($reply);
     sleep(3);
     $value = $this->rediska->get('test');
     $this->assertNull($value);
 }
开发者ID:utachkin,项目名称:Rediska,代码行数:13,代码来源:Cache.php

示例5: 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

示例6: get

 /**
  * get by id
  * - results are cached
  *
  * @param string $_id the id of the peer
  * @return Voipmanager_Model_Snom_Location
  */
 public function get($_id)
 {
     $id = Tinebase_Record_Abstract::convertId($_id, $this->_modelName);
     if ($this->_cacheIdPrefix && $this->_cache) {
         $cacheId = $this->_cacheIdPrefix . $id;
         if ($this->_cache->test($id)) {
             $result = $this->_cache->load($id);
         } else {
             $result = $this->_backend->get($id);
             $this->_cache->save($result, $cacheId, array($this->_cacheIdPrefix), 5);
         }
     } else {
         $result = $this->_backend->get($id);
     }
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:23,代码来源:Abstract.php

示例7: _addTranslationData

 /**
  * Internal function for adding translation data
  *
  * It may be a new language or additional data for existing language
  * If $clear parameter is true, then translation data for specified
  * language is replaced and added otherwise
  *
  * @see    Zend_Locale
  * @param  array|string       $data    Translation data
  * @param  string|Zend_Locale $locale  Locale/Language to add data for, identical with locale identifier,
  *                                     @see Zend_Locale for more information
  * @param  array              $options (optional) Option for this Adapter
  * @throws Zend_Translate_Exception
  * @return Zend_Translate_Adapter Provides a fluid interface
  */
 private function _addTranslationData($data, $locale, array $options = array())
 {
     if (!($locale = Zend_Locale::isLocale($locale))) {
         /**
          * @see Zend_Translate_Exception
          */
         require_once 'Zend/Translate/Exception.php';
         throw new Zend_Translate_Exception("The given Language ({$locale}) does not exist");
     }
     if (!array_key_exists($locale, $this->_translate)) {
         $this->_translate[$locale] = array();
     }
     $this->_loadTranslationData($data, $locale, $options);
     if ($this->_automatic === true) {
         $find = new Zend_Locale($locale);
         $browser = $find->getBrowser() + $find->getEnvironment();
         arsort($browser);
         foreach ($browser as $language => $quality) {
             if (array_key_exists($language, $this->_translate)) {
                 $this->_options['locale'] = $language;
                 break;
             }
         }
     }
     if (isset(self::$_cache)) {
         $id = 'Zend_Translate_' . $this->toString();
         $temp = $this->_translate;
         $temp['_options_'] = $this->_options;
         self::$_cache->save(serialize($temp), $id);
     }
     return $this;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:47,代码来源:Adapter.php

示例8: setKeys

 protected function setKeys()
 {
     $this->cache->save('aaa', 'test_aaa', array('tag_a1'));
     $this->cache->save('bbb', 'test_bbb', array('tag_a1', 'tag_a2'));
     $this->cache->save('ccc', 'test_ccc', array('tag_a2'));
     $this->cache->save('ddd', 'test_ddd', array('tag_a3'));
 }
开发者ID:r-kovalenko,项目名称:Rediska,代码行数:7,代码来源:CacheTest.php

示例9: _replaceEsiInclude

 /**
  * Replace one found esi include with a given url
  *
  * @param string $url
  * @return string|null
  */
 protected function _replaceEsiInclude($url)
 {
     $uri = 'http://' . $_SERVER['HTTP_HOST'] . $url;
     $key = $this->_getCacheId($uri);
     if ($this->_cacheEnabled()) {
         // detect if url is cached
         $data = self::$_cache->load($key);
         if (false !== $data) {
             return $data;
         }
     }
     $fp = fopen($uri, 'r', false, $this->_getHttpContext());
     if (false !== $fp) {
         $data = stream_get_contents($fp);
         if ($this->_cacheEnabled()) {
             $meta = stream_get_meta_data($fp);
             // fetch the metadata of the fopen call
             foreach ($meta['wrapper_data'] as $header) {
                 $match = array();
                 if (preg_match(self::ESI_CACHE_REGEX, $header, $match)) {
                     if (false !== $data) {
                         // cache url with the respected max-age setting
                         self::$_cache->save($data, $key, array(), intval($match[1]));
                         break;
                     }
                 }
             }
         }
         fclose($fp);
         return $data;
     }
     return null;
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:39,代码来源:EsiParser.php

示例10: 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

示例11: _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

示例12: _saveInCache

 /**
  * Save in cache
  *
  * @return void
  */
 private function _saveInCache(Zend_Cache_Core $cache)
 {
     $cacheData = array();
     $cacheData['tableName'] = $this->_dbData->getTable()->getComponentName();
     $cacheData['dataArray'] = $this->_dbData->toArray(self::SERIALIZATION_DEEP);
     $cache->save($cacheData, $this->_cacheKey);
 }
开发者ID:EricHogue,项目名称:Koryukan,代码行数:12,代码来源:Collection.php

示例13: getHistorical

 public function getHistorical($name, $date)
 {
     $sufix = str_replace('-', '', substr($date, 0, 10));
     $cached = $this->_cache->load(__CLASS__ . $name . $sufix);
     if ($cached !== false) {
         return $cached;
     } else {
         $row = $this->fetchRow(array('key = ?' => $name, 'created_at::date <= \'' . $date . '\'::date'), 'id DESC');
         if ($row !== null) {
             $this->_cache->save($row->value, __CLASS__ . $name . $sufix);
             return $row->value;
         } else {
             return $this->get($name);
         }
     }
 }
开发者ID:knatorski,项目名称:SMS,代码行数:16,代码来源:Settings.php

示例14: _getSelectProcessedCached

 /**
  * Utility function for loading a query from cache
  *
  * @param string $cacheId The class is prepended to this id
  * @param mixed $sql string or \Zend_Db_Select
  * @param callable $function The function called with each row to form the result
  * @param string $keyField The field containing the key for each row
  * @param mixed $tags string or array of strings
  * @param string Optional function to sort on, only known functions will do
  * @return array
  */
 protected function _getSelectProcessedCached($cacheId, $sql, $function, $keyField, $tags = array(), $sort = null)
 {
     $cacheId = get_class($this) . '_' . $cacheId;
     $result = false;
     //$this->cache->load($cacheId);
     if ($result) {
         return $result;
     }
     $result = array();
     try {
         $rows = $this->db->fetchAll($sql);
         if ($rows) {
             foreach ($rows as $row) {
                 if (!isset($result[$row[$keyField]])) {
                     $result[$row[$keyField]] = call_user_func($function, $row);
                 }
             }
             if ($sort) {
                 $this->_sortResult($result, $sort);
             }
         }
         $this->cache->save($result, $cacheId, (array) $tags);
     } catch (\Zend_Db_Statement_Mysqli_Exception $e) {
     }
     return $result;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:37,代码来源:UtilAbstract.php

示例15: query

 /**
  * Perform a raw query against the search index, returning a SolrResultSet object that 
  * can be used to extract a more complete result set
  *
  * @param String $query
  * 			The lucene query to execute.
  * @param int $page
  * 			What result page are we on?
  * @param int $limit
  * 			How many items to limit the query to return
  * @param array $params
  * 			A set of parameters to be passed along with the query
  * @param array $andWith
  *			A set of extra and with terms to add to the query
  * @return SolrResultSet
  */
 public function query($query, $offset = 0, $limit = 20, $params = array(), $andWith = array())
 {
     if (is_string($query)) {
         $builder = $this->getQueryBuilder('default');
         $builder->baseQuery($query);
         $query = $builder;
     }
     // be very specific about the subsite support :).
     if (ClassInfo::exists('Subsite')) {
         $query->andWith('SubsiteID_i', Subsite::currentSubsiteID());
     }
     // add the stage details in - we should probably use an extension mechanism for this,
     // but for now this will have to do. @TODO Refactor this....
     $stage = Versioned::current_stage();
     if (!$stage && !(isset($params['ignore_stage']) && $params['ignore_stage'])) {
         // default to searching live content only
         $stage = 'Live';
     }
     if (!isset($params['ignore_stage']) || !$params['ignore_stage']) {
         $query->andWith('SS_Stage_ms', $stage);
     }
     if ($andWith) {
         foreach ($andWith as $field => $value) {
             $query->andWith($field, $value);
         }
     }
     $extraParams = $query->getParams();
     $params = array_merge($params, $extraParams);
     $query = $query->toString();
     $response = null;
     $rawResponse = null;
     $solr = $this->getSolr();
     $key = null;
     if ($this->cache) {
         $key = md5($query . $offset . $limit . serialize($params));
         if ($rawResponse = $this->cache->load($key)) {
             $response = new Apache_Solr_Response($rawResponse, array('HTTP/1.1 200 OK', 'Content-Type: text/plain; charset=utf-8'), $solr->getCreateDocuments(), $solr->getCollapseSingleValueArrays());
         }
     }
     if (!$response) {
         // Execute the query and log any errors on failure, always displaying the search results to the user.
         if ($this->isConnected()) {
             try {
                 $response = $this->getSolr()->search($query, $offset, $limit, $params);
             } catch (Exception $e) {
                 SS_Log::log($e, SS_Log::NOTICE);
             }
         }
     }
     $queryParams = new stdClass();
     $queryParams->offset = $offset;
     $queryParams->limit = $limit;
     $queryParams->params = $params;
     $results = new SolrResultSet($query, $response, $queryParams, $this);
     if ($this->cache && !$rawResponse && $key && $response) {
         $this->cache->save($response->getRawResponse(), $key, array(), $this->cacheTime);
     }
     return $results;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-solr,代码行数:75,代码来源:SolrSearchService.php


注:本文中的Zend_Cache_Core::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。