/**
  * Delete a cell in cache identified by coordinate address
  *
  * @param    string $pCoord Coordinate address of the cell to delete
  *
  * @throws    PHPExcel_Exception
  */
 public function deleteCacheData($pCoord)
 {
     //	Delete the entry from Memcache
     $this->_memcache->delete($this->_cachePrefix . $pCoord . '.cache');
     //	Delete the entry from our cell address array
     parent::deleteCacheData($pCoord);
 }
 /**
  * 处理任务数据的回调方法
  * @param function $callback
  * @param resource $vendorInstance
  * @param array $option
  * @throws MyRuntimeException
  */
 public static function processJobData($callback, $vendorInstance, $option = array())
 {
     $option += array('decode' => TRUE, 'delete' => TRUE, 'release' => FALSE, 'delay' => 10, 'priority' => 1024, 'timeout' => NULL);
     $retData = NULL;
     //echo 'proceed job data'.PHP_EOL;
     //var_dump($vendorInstance);
     $job = $vendorInstance->reserve($option['timeout']);
     //var_dump($job);
     if ($job) {
         if ($option['decode'] == TRUE) {
             $arg = self::decodeData($job->getData());
         } else {
             $arg = $job->getData();
         }
         if (!is_callable($callback)) {
             throw new RuntimeException('process data error');
         }
         $retData = call_user_func($callback, $arg);
         if (!$retData) {
             if ($option['release'] == TRUE) {
                 $vendorInstance->release($job, $option['priority'], $option['delay']);
             }
             throw new RuntimeException('process data error');
         }
         if ($option['delete'] == TRUE) {
             $vendorInstance->delete($job);
         }
     } else {
         $arg = $job;
     }
     return $retData;
 }
Example #3
0
 /**
  * Destroy this cell collection
  */
 public function __destruct()
 {
     $cacheList = $this->getCellList();
     foreach ($cacheList as $cellID) {
         $this->_memcache->delete($this->_cachePrefix . $cellID . '.cache');
     }
 }
Example #4
0
 /**
  * Releases a lock on the given $key. 
  * 
  * @param string $key 
  * @return void
  */
 public function releaseLock($key)
 {
     if (strlen($key) > self::MAX_KEY_LENGTH) {
         throw new ezcCacheInvalidKeyException($key, 'Length > ' . self::MAX_KEY_LENGTH . '.');
     }
     $this->memcache->delete($key);
 }
Example #5
0
 /**
  * 删除缓存
  * [code]
  * $memcache->remove('key');
  * $memcache->remove(array('key1', 'key2'));
  * [/code]
  *
  * @access public
  * @return void
  */
 public function remove($keys)
 {
     if (is_array($keys)) {
         while (list(, $key) = each($keys)) {
             $this->remove($key);
         }
     } else {
         $this->_conn->delete($keys);
     }
 }
 /**
  * Destroy
  *
  * Destroys the current session.
  *
  * @param	string	$session_id	Session ID
  * @return	bool
  */
 public function destroy($session_id)
 {
     if (isset($this->_redis, $this->_lock_key)) {
         if (($result = $this->_redis->delete($this->_key_prefix . $session_id)) !== 1) {
             log_message('debug', 'Session: Redis::delete() expected to return 1, got ' . var_export($result, TRUE) . ' instead.');
         }
         $this->_cookie_destroy();
         return $this->_success;
     }
     return $this->_fail();
 }
 /**
  * Release lock
  *
  * Releases a previously acquired lock
  *
  * @return	bool
  */
 protected function _release_lock()
 {
     if (isset($this->_redis, $this->_lock_key) && $this->_lock) {
         if (!$this->_redis->delete($this->_lock_key)) {
             return FALSE;
         }
         $this->_lock_key = NULL;
         $this->_lock = FALSE;
     }
     return TRUE;
 }
Example #8
0
 /**
  * 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());
     }
 }
Example #9
0
 /**
  * Release lock
  *
  * Releases a previously acquired lock
  *
  * @return	bool
  */
 protected function releaseLock() : bool
 {
     if (isset($this->redis, $this->lockKey) && $this->lock) {
         if (!$this->redis->delete($this->lockKey)) {
             $this->logger->error('Session: Error while trying to free lock for ' . $this->lockKey);
             return FALSE;
         }
         $this->lockKey = NULL;
         $this->lock = FALSE;
     }
     return TRUE;
 }
Example #10
0
 /**
  * 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());
     }
 }
 /**
  * Release lock.
  *
  * Releases a previously acquired lock
  *
  * @return bool
  */
 protected function _release_lock()
 {
     if (isset($this->_redis, $this->_lock_key) && $this->_lock) {
         if (!$this->_redis->delete($this->_lock_key)) {
             log_message('error', 'Session: Error while trying to free lock for ' . $this->_lock_key);
             return false;
         }
         $this->_lock_key = null;
         $this->_lock = false;
     }
     return true;
 }
 /**
  * Release lock
  *
  * Releases a previously acquired lock
  *
  * @return	bool
  */
 protected function _release_lock()
 {
     if (isset($this->_redis, $this->_lock_key) && $this->_lock) {
         if (!$this->_redis->delete($this->_lock_key)) {
             log_message('error', 'Session: Error while trying to free lock for ' . $this->_lock_key);
             return FALSE;
         }
         $this->_lock_key = NULL;
         $this->_lock = FALSE;
     }
     return TRUE;
 }
Example #13
0
 /**
  * 释放资源锁
  * @param string $key 缓存锁键
  * @param string $server_key 指定服务器
  * @return bool
  */
 private function _releaseLock($keys, $server_key = null)
 {
     $keys = $this->_buildKey($keys, 'LOCK_CTL');
     $calls = 0;
     if (is_array($keys)) {
         if (is_null($server_key)) {
             $this->mcd->deleteMulti($keys);
         } else {
             $this->mcd->deleteMultiByKey($server_key, $keys);
         }
         $calls += count($keys);
     } else {
         if (is_null($server_key)) {
             $this->mcd->delete($keys);
         } else {
             $this->mcd->deleteByKey($server_key, $keys);
         }
         $calls++;
     }
     BaseModelCommon::addStatInfo('mc', 0, $calls);
 }
Example #14
0
 /**
  * Deletes a file or directory on the SFTP/FTP server.
  *
  * @param string $path
  * @param bool   $recursive if $path is a directory, it will delete also its content
  *
  * @return bool
  */
 public function delete($path, $recursive = true)
 {
     switch ($this->_connType) {
         case SftpHelper::TYPE_SFTP:
         default:
             $res = $this->_connection->delete($path, $recursive);
             break;
         case SftpHelper::TYPE_FTP:
             $res = @ftp_delete($this->_connection, $path);
             if (!$res && $recursive) {
                 $list = @ftp_nlist($this->_connection, $path);
                 // if $path exists and it is a directory:
                 if (!empty($list)) {
                     foreach ($list as $file) {
                         $this->delete($file, true);
                     }
                     // deleting the parent path after the recursion
                     $res = $this->delete($path, false);
                 }
             }
             break;
     }
     return $res;
 }
Example #15
0
 /**
  * 释放资源锁
  * @param string $key 缓存锁键
  */
 public function releaseLock($key)
 {
     $this->mc->delete($key . self::CACHE_LOCK_CTL);
 }
Example #16
0
 /**
  * @param $key
  *
  * @return mixed
  */
 function delete($key)
 {
     $key = $this->cleanKey($key);
     return $this->_cache->delete($key);
 }
Example #17
0
 /**
  * Destroys the session data from the memcache based session storage handler
  *
  * @param string $id The ID of the session
  * @access protected
  */
 protected function _destroy($id)
 {
     $id = 'sess_' . $id;
     return $this->_conn->delete($id);
 }
Example #18
0
 /**
  * 删除指定的缓存
  *
  * @param string $id
  * @return boolean
  */
 function remove($id)
 {
     return $this->_conn->delete($id);
 }
Example #19
0
	/**
	 * Unlock cache index
	 *
	 * @return	boolean	True on success, false otherwise.
	 * @since	Nooku Server 0.7
	 */
	private function unlockindex()
	{
		return $this->_db->delete($this->_hash.'-index_lock');
	}
Example #20
0
 /**
  * @param $key
  *
  * @return mixed
  */
 public function delete($key)
 {
     return $this->_cache->delete($this->_prefix . $key);
 }
Example #21
0
 function delete($key)
 {
     return $this->_cache->delete($key);
 }
Example #22
0
 /**
  * Remove a cached data entry by id and group
  *
  * @access	public
  * @param	string	$id		The cache data id
  * @param	string	$group	The cache data group
  * @return	boolean	True on success, false otherwise
  * @since	1.5
  */
 function remove($id, $group)
 {
     $cache_id = $this->_getCacheId($id, $group);
     return $this->_db->delete($cache_id);
 }
 /**
  * del
  * @param string $key
  * @param string $tableName
  * @param resource $connectionResource
  * @return boolean
  */
 public function del($key, $tableName, $connectionResource)
 {
     return $connectionResource->delete($this->getRealKey($tableName, $key));
 }
 /**
  * Delete a file
  * @param string
  * @return boolean
  */
 public function delete($strFile)
 {
     $this->connect();
     return $this->objConnection->delete($strFile);
 }
Example #25
0
 /**
  * Removes the item from the Redis server.
  * @see cecilia\core.StorageAdapter::remove()
  */
 public function remove($key)
 {
     return $this->_conn->delete($this->prefix . $key) ? true : false;
 }