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


PHP Zend_Cache::throwException方法代码示例

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


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

示例1: save

 /**
  * Save some data in a cache
  *
  * @param  mixed $data           Data to put in cache (can be another type than string if automatic_serialization is on)
  * @param  string $id             Cache id (if not set, the last cache id will be used)
  * @param  array $tags           Cache tags
  * @param  int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
  * @throws Zend_Cache_Exception
  * @return boolean True if no problem
  */
 public function save($data, $id = null, $tags = array(), $specificLifetime = false, $priority = 8)
 {
     if (!$this->_options['caching']) {
         return true;
     }
     if ($id === null) {
         $id = $this->_lastId;
     } else {
         $id = $this->_id($id);
     }
     self::_validateIdOrTag($id);
     if (is_resource($data)) {
         Zend_Cache::throwException('Data can\'t be a resource as it can\'t be serialized');
     }
     /*if ($this->_options['ignore_user_abort'])
       {
           $abort = ignore_user_abort(true);
       }*/
     $result = $this->_backend->save($data, $id, $tags, $specificLifetime);
     /*if ($this->_options['ignore_user_abort'])
       {
           ignore_user_abort($abort);
       }*/
     if (!$result) {
         // maybe the cache is corrupted, so we remove it !
         if ($this->_options['logging']) {
             $this->_log(__CLASS__ . '::' . __METHOD__ . '() : impossible to save cache (id=' . $id . ')');
         }
         $this->remove($id);
         return false;
     }
     return true;
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:43,代码来源:Class.php

示例2: __construct

 /**
  * Constructor
  * 
  * @param array $options associative array of options
  */
 public function __construct($options = array())
 {
     if (!extension_loaded('apc')) {
         Zend_Cache::throwException('The apc extension must be loaded for using this backend !');
     }
     parent::__construct($options);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:12,代码来源:Apc.php

示例3: __construct

 /**
  * Constructor
  *
  * @param  array $options associative array of options
  * @throws Zend_Cache_Exception
  */
 public function __construct(array $options = array())
 {
     if (!function_exists('zend_shm_cache_store')) {
         Zend_Cache::throwException('Zend_Cache_ZendServer_ShMem backend has to be used within Zend Server environment.');
     }
     parent::__construct($options);
 }
开发者ID:Gradven,项目名称:what3.1.7,代码行数:13,代码来源:ShMem.php

示例4: __construct

 /**
  * Constructor
  * 
  * @param array $options associative array of options
  */
 public function __construct($options = array())
 {
     if (!extension_loaded('memcache')) {
         Zend_Cache::throwException('The memcache extension must be loaded for using this backend !');
     }
     parent::__construct($options);
     if (isset($options['servers'])) {
         $value = $options['servers'];
         if (isset($value['host'])) {
             // in this case, $value seems to be a simple associative array (one server only)
             $value = array(0 => $value);
             // let's transform it into a classical array of associative arrays
         }
         $this->setOption('servers', $value);
     }
     $this->_memcache = new Memcache();
     foreach ($this->_options['servers'] as $server) {
         if (!array_key_exists('persistent', $server)) {
             $server['persistent'] = Zend_Cache_Backend_Memcached::DEFAULT_PERSISTENT;
         }
         if (!array_key_exists('port', $server)) {
             $server['port'] = Zend_Cache_Backend_Memcached::DEFAULT_PORT;
         }
         $this->_memcache->addServer($server['host'], $server['port'], $server['persistent']);
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:Memcached.php

示例5: setMasterFile

 /**
  * Change the master_file option
  * 
  * @param string $masterFile the complete path and name of the master file
  */
 public function setMasterFile($masterFile)
 {
     clearstatcache();
     $this->_specificOptions['master_file'] = $masterFile;
     if (!($this->_masterFile_mtime = @filemtime($masterFile))) {
         Zend_Cache::throwException('Unable to read master_file : ' . $masterFile);
     }
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:13,代码来源:File.php

示例6: _flush

 /**
  * callback for output buffering
  * (shouldn't really be called manually)
  *
  * @param  string $data Buffered output
  * @return string Data to send to browser
  */
 public function _flush($data)
 {
     $id = array_pop($this->_idStack);
     if (is_null($id)) {
         Zend_Cache::throwException('use of end() without a start()');
     }
     $this->save($data, $id, $this->_tags);
     return $data;
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:16,代码来源:Capture.php

示例7: __construct

 /**
  * Constructor
  * 
  * @param array $options associative array of options
  * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
  */
 public function __construct($options = array())
 {
     if (isset($options['httpConditional'])) {
         if ($options['httpConditional']) {
             Zend_Cache::throwException('httpConditional is not implemented for the moment !');
         }
     }
     parent::__construct($options);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:15,代码来源:Page.php

示例8: _flush

 /**
  * callback for output buffering
  * (shouldn't really be called manually)
  *
  * @param  string $data Buffered output
  * @return string Data to send to browser
  */
 public function _flush($data)
 {
     $id = array_pop($this->_idStack);
     if (is_null($id)) {
         Zend_Cache::throwException('use of _flush() without a start()');
     }
     file_put_contents('/var/www/data.dump', $data);
     $this->save($data, $id, $this->_tags);
     return $data;
 }
开发者ID:crlang44,项目名称:frapi,代码行数:17,代码来源:Capture.php

示例9: __construct

 /**
  * Constructor
  *
  * @param array $options associative array of options
  * @throws Zend_Cache_Exception
  * @return void
  */
 public function __construct($options = array())
 {
     if ($options['backend'] instanceof Zend_Cache_Backend_Interface || $options['backend'] instanceof Tid_Zend_Cache_Backend_Abstract) {
         $this->_backend = $options['backend'];
     } else {
         Zend_Cache::throwException('The backend option is not correctly set!');
     }
     $this->_id = '__' . get_class($this) . '__';
     parent::__construct($options);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:17,代码来源:TagsEmu.php

示例10: __construct

 /**
  * Constructor
  * 
  * @param array $options associative array of options
  * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
  */
 public function __construct($options = array())
 {
     if (isset($options['httpConditional'])) {
         if ($options['httpConditional']) {
             Zend_Cache::throwException('httpConditional is not implemented for the moment !');
         }
     }
     while (list($name, $value) = each($options)) {
         $this->setOption($name, $value);
     }
 }
开发者ID:BackupTheBerlios,项目名称:umlrecord,代码行数:17,代码来源:Page.php

示例11: __construct

 /**
  * Constructor
  * 
  * @param array $options associative array of options
  */
 public function __construct($options = array())
 {
     while (list($name, $value) = each($options)) {
         $this->setOption($name, $value);
     }
     if (!isset($this->_specificOptions['master_file'])) {
         Zend_Cache::throwException('master_file option must be set');
     }
     clearstatcache();
     if (!($this->_masterFile_mtime = @filemtime($this->_specificOptions['master_file']))) {
         Zend_Cache::throwException('Unable to read master_file : ' . $this->_specificOptions['master_file']);
     }
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:18,代码来源:File.php

示例12: _flush

 /**
  * callback for output buffering
  * (shouldn't really be called manually)
  *
  * @param  string $data Buffered output
  * @return string Data to send to browser
  */
 public function _flush($data)
 {
     $id = array_pop($this->_idStack);
     if ($id === null) {
         Zend_Cache::throwException('use of _flush() without a start()');
     }
     if ($this->_extension) {
         $this->save(serialize(array($data, $this->_extension)), $id, $this->_tags);
     } else {
         $this->save($data, $id, $this->_tags);
     }
     return $data;
 }
开发者ID:conectapb,项目名称:sysagroweb,代码行数:20,代码来源:Capture.php

示例13: __construct

 /**
  * @param array $options
  */
 public function __construct(array $options = [])
 {
     if (array_key_exists('concrete_backend', $options) && $options['concrete_backend'] instanceof \Zend_Cache_Backend_Interface) {
         $this->_backend = $options['concrete_backend'];
         unset($options['concrete_backend']);
     } else {
         \Zend_Cache::throwException("'concrete_backend' is not specified or it does not implement 'Zend_Cache_Backend_Interface' interface");
     }
     foreach ($options as $optionName => $optionValue) {
         if (array_key_exists($optionName, $this->_decoratorOptions)) {
             $this->_decoratorOptions[$optionName] = $optionValue;
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AbstractDecorator.php

示例14: __construct

 /**
  * Constructor
  * 
  * @param array $options associative array of options
  */
 public function __construct($options = array())
 {
     if (!isset($options['cachedEntity'])) {
         Zend_Cache::throwException('cachedEntity must be set !');
     } else {
         if (!is_string($options['cachedEntity']) && !is_object($options['cachedEntity'])) {
             Zend_Cache::throwException('cachedEntity must be an object or a class name');
         }
     }
     $this->_cachedEntity = $options['cachedEntity'];
     while (list($name, $value) = each($options)) {
         $this->setOption($name, $value);
     }
     $this->setOption('automaticSerialization', true);
 }
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:20,代码来源:Class.php

示例15: setOption

 /**
  * Set an option
  * 
  * @param string $name name of the option
  * @param mixed $value value of the option
  */
 public function setOption($name, $value)
 {
     if (is_string($name)) {
         if (array_key_exists($name, $this->_options)) {
             // This is a Core option
             parent::setOptions($name, $value);
             return;
         }
         if (array_key_exists($name, $this->_specificOptions)) {
             // This a specic option of this frontend
             $this->_specificOptions[$name] = $value;
             return;
         }
     }
     Zend_Cache::throwException("Incorrect option name : {$name}");
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:22,代码来源:File.php


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