本文整理汇总了PHP中resource::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::delete方法的具体用法?PHP resource::delete怎么用?PHP resource::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource
的用法示例。
在下文中一共展示了resource::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteCacheData
/**
* 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);
}
示例2: processJobData
/**
* 处理任务数据的回调方法
* @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;
}
示例3: __destruct
/**
* Destroy this cell collection
*/
public function __destruct()
{
$cacheList = $this->getCellList();
foreach ($cacheList as $cellID) {
$this->_memcache->delete($this->_cachePrefix . $cellID . '.cache');
}
}
示例4: releaseLock
/**
* 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);
}
示例5: remove
/**
* 删除缓存
* [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);
}
}
示例6: destroy
/**
* 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();
}
示例7: _release_lock
/**
* 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;
}
示例8: _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());
}
}
示例9: releaseLock
/**
* 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;
}
示例10: 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());
}
}
示例11: _release_lock
/**
* 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;
}
示例12: _release_lock
/**
* 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;
}
示例13: _releaseLock
/**
* 释放资源锁
* @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);
}
示例14: delete
/**
* 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;
}
示例15: releaseLock
/**
* 释放资源锁
* @param string $key 缓存锁键
*/
public function releaseLock($key)
{
$this->mc->delete($key . self::CACHE_LOCK_CTL);
}