當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。