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


PHP resource::replace方法代码示例

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


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

示例1: storeData

 /**
  * Store cell data in cache for the current cell object if it's "dirty",
  *     and the 'nullify' the current cell object
  *
  * @throws  \PHPExcel\Exception
  */
 protected function storeData()
 {
     if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
         $this->currentObject->detach();
         $obj = serialize($this->currentObject);
         if (!$this->memcache->replace($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
             if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
                 $this->__destruct();
                 throw new \PHPExcel\Exception("Failed to store cell {$this->currentObjectID} in MemCache");
             }
         }
         $this->currentCellIsDirty = false;
     }
     $this->currentObjectID = $this->currentObject = null;
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:21,代码来源:Memcache.php

示例2: _storeData

 /**
  * Store cell data in cache for the current cell object if it's "dirty",
  *     and the 'nullify' the current cell object
  *
  * @return	void
  * @throws	PHPExcel_Exception
  */
 protected function _storeData()
 {
     if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
         $this->_currentObject->detach();
         $obj = serialize($this->_currentObject);
         if (!$this->_memcache->replace($this->_cachePrefix . $this->_currentObjectID . '.cache', $obj, NULL, $this->_cacheTime)) {
             if (!$this->_memcache->add($this->_cachePrefix . $this->_currentObjectID . '.cache', $obj, NULL, $this->_cacheTime)) {
                 $this->__destruct();
                 throw new PHPExcel_Exception('Failed to store cell ' . $this->_currentObjectID . ' in MemCache');
             }
         }
         $this->_currentCellIsDirty = false;
     }
     $this->_currentObjectID = $this->_currentObject = null;
 }
开发者ID:arjunkumar786,项目名称:faces,代码行数:22,代码来源:Memcache.php

示例3: _write

 /**
  * Writes session data to the memcache based session storage handler
  *
  * @param string $id The ID of the session
  * @param string $value The session data to store
  * @access protected
  */
 protected function _write($id, $value)
 {
     $id = 'sess_' . $id;
     if ($this->_conn->get($id)) {
         return $this->_conn->replace($id, $value, 0, $this->_life_time);
     } else {
         return $this->_conn->set($id, $value, 0, $this->_life_time);
     }
 }
开发者ID:heshuai64,项目名称:gamestore,代码行数:16,代码来源:memcache.php

示例4: _setExpire

 /**
  * Set expire time on each call since memcached sets it on cache creation.
  *
  * @param   string  $key  Cache key to expire.
  *
  * @return  void
  *
  * @since   11.1
  */
 protected function _setExpire($key)
 {
     $lifetime = ini_get("session.gc_maxlifetime");
     $expire = $this->_db->get($key . '_expire');
     // Set prune period
     if ($expire + $lifetime < time()) {
         $this->_db->delete($key);
         $this->_db->delete($key . '_expire');
     } else {
         $this->_db->replace($key . '_expire', time());
     }
 }
开发者ID:nogsus,项目名称:joomla-platform,代码行数:21,代码来源:memcached.php

示例5: time

 /**
  * Set expire time on each call since memcache sets it on cache creation.
  *
  * @access private
  *
  * @param string  $key   Cache key to expire.
  * @param integer $lifetime  Lifetime of the data in seconds.
  */
 function _setExpire($key)
 {
     $lifetime = $this->_lifetime;
     $expire = $this->_db->get($key . '_expire');
     // set prune period
     if ($expire + $lifetime < time()) {
         $this->_db->delete($key);
         $this->_db->delete($key . '_expire');
     } else {
         $this->_db->replace($key . '_expire', time());
     }
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:20,代码来源:memcache.php

示例6: clean

 /**
  * Clean cache for a group given a mode.
  *
  * group mode		: cleans all cache in the group
  * notgroup mode	: cleans all cache not in the group
  *
  * @access	public
  * @param	string	$group	The cache data group
  * @param	string	$mode	The mode for cleaning cache [group|notgroup]
  * @return	boolean	True on success, false otherwise
  * @since	1.5
  */
 function clean($group, $mode)
 {
     if (!$this->lockindex()) {
         return false;
     }
     $index = $this->_db->get($this->_hash . '-index');
     if ($index === false) {
         $index = array();
     }
     $secret = $this->_hash;
     foreach ($index as $key => $value) {
         if (strpos($value->name, $secret . '-cache-' . $group . '-' . $this->_site) === 0 xor $mode != 'group') {
             $this->_db->delete($value->name, 0);
             unset($index[$key]);
         }
     }
     $this->_db->replace($this->_hash . '-index', $index, 0, 0);
     $this->unlockindex();
     return true;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:32,代码来源:memcache.php

示例7: update

 /**
  * update
  * @param string $key
  * @param string|array|object $value
  * @param int $ttl
  * @param string $tableName
  * @param resource $connectionResource
  * @return boolean
  */
 public function update($key, $value, $ttl = 0, $tableName = '', $connectionResource = null)
 {
     return $connectionResource->replace($this->getRealKey($tableName, $key), $value, $ttl);
 }
开发者ID:zhangshijle,项目名称:Python3,代码行数:13,代码来源:CacheAdapterMemcached.php


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