本文整理汇总了PHP中BagOStuff::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP BagOStuff::delete方法的具体用法?PHP BagOStuff::delete怎么用?PHP BagOStuff::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BagOStuff
的用法示例。
在下文中一共展示了BagOStuff::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($key, $flags = 0)
{
unset($this->bag[$key]);
if (!($flags & self::WRITE_CACHE_ONLY)) {
$this->backend->delete($key);
}
return true;
}
示例2: doGetAllReadyWikiQueues
/**
* @see JobQueueAggregator::doAllGetReadyWikiQueues()
*/
protected function doGetAllReadyWikiQueues()
{
$key = $this->getReadyQueueCacheKey();
// If the cache entry wasn't present, is stale, or in .1% of cases otherwise,
// regenerate the cache. Use any available stale cache if another process is
// currently regenerating the pending DB information.
$pendingDbInfo = $this->cache->get($key);
if (!is_array($pendingDbInfo) || time() - $pendingDbInfo['timestamp'] > $this->cacheTTL || mt_rand(0, 999) == 0) {
if ($this->cache->add("{$key}:rebuild", 1, 1800)) {
// lock
$pendingDbInfo = array('pendingDBs' => $this->findPendingWikiQueues(), 'timestamp' => time());
for ($attempts = 1; $attempts <= 25; ++$attempts) {
if ($this->cache->add("{$key}:lock", 1, 60)) {
// lock
$this->cache->set($key, $pendingDbInfo);
$this->cache->delete("{$key}:lock");
// unlock
break;
}
}
$this->cache->delete("{$key}:rebuild");
// unlock
}
}
return is_array($pendingDbInfo) ? $pendingDbInfo['pendingDBs'] : array();
// cache is both empty and locked
}
示例3: closeConnection
/**
* Close the connection to the Swift proxy
*
* @return void
*/
protected function closeConnection()
{
if ($this->conn) {
$this->srvCache->delete($this->getCredsCacheKey($this->auth->username));
$this->conn->close();
// close active cURL handles in CF_Http object
$this->conn = null;
$this->connStarted = 0;
}
}
示例4: doFlushCaches
protected function doFlushCaches()
{
static $types = array('empty', 'size', 'acquiredcount', 'delayedcount', 'abandonedcount');
foreach ($types as $type) {
$this->cache->delete($this->getCacheKey($type));
}
foreach ($this->partitionQueues as $queue) {
$queue->doFlushCaches();
}
}
示例5: onError
/**
* Log an unexpected exception for this backend.
* This also sets the Status object to have a fatal error.
*
* @param Status|null $status
* @param string $func
* @param array $params
* @param string $err Error string
* @param int $code HTTP status
* @param string $desc HTTP status description
*/
public function onError($status, $func, array $params, $err = '', $code = 0, $desc = '')
{
if ($status instanceof Status) {
$status->fatal('backend-fail-internal', $this->name);
}
if ($code == 401) {
// possibly a stale token
$this->srvCache->delete($this->getCredsCacheKey($this->swiftUser));
}
wfDebugLog('SwiftBackend', "HTTP {$code} ({$desc}) in '{$func}' (given '" . FormatJson::encode($params) . "')" . ($err ? ": {$err}" : ""));
}
示例6: testGetMulti
/**
* @covers BagOStuff::getMulti
*/
public function testGetMulti()
{
$value1 = array('this' => 'is', 'a' => 'test');
$value2 = array('this' => 'is', 'another' => 'test');
$key1 = wfMemcKey('test1');
$key2 = wfMemcKey('test2');
$this->cache->add($key1, $value1);
$this->cache->add($key2, $value2);
$this->assertEquals($this->cache->getMulti(array($key1, $key2)), array($key1 => $value1, $key2 => $value2));
// cleanup
$this->cache->delete($key1);
$this->cache->delete($key2);
}
示例7: testGetMulti
/**
* @covers BagOStuff::getMulti
*/
public function testGetMulti()
{
$value1 = array('this' => 'is', 'a' => 'test');
$value2 = array('this' => 'is', 'another' => 'test');
$value3 = array('testing a key that may be encoded when sent to cache backend');
$key1 = wfMemcKey('test1');
$key2 = wfMemcKey('test2');
$key3 = wfMemcKey('will-%-encode');
// internally, MemcachedBagOStuffs will encode to will-%25-encode
$this->cache->add($key1, $value1);
$this->cache->add($key2, $value2);
$this->cache->add($key3, $value3);
$this->assertEquals(array($key1 => $value1, $key2 => $value2, $key3 => $value3), $this->cache->getMulti(array($key1, $key2, $key3)));
// cleanup
$this->cache->delete($key1);
$this->cache->delete($key2);
$this->cache->delete($key3);
}
示例8: handleException
/**
* Log an unexpected exception for this backend.
* This also sets the Status object to have a fatal error.
*
* @param $e Exception
* @param $status Status|null
* @param $func string
* @param array $params
* @return void
*/
protected function handleException(Exception $e, $status, $func, array $params)
{
if ($status instanceof Status) {
if ($e instanceof AuthenticationException) {
$status->fatal('backend-fail-connect', $this->name);
} else {
$status->fatal('backend-fail-internal', $this->name);
}
}
if ($e->getMessage()) {
trigger_error("{$func}: " . $e->getMessage(), E_USER_WARNING);
}
if ($e instanceof InvalidResponseException) {
// possibly a stale token
$this->srvCache->delete($this->getCredsCacheKey($this->auth->username));
$this->closeConnection();
// force a re-connect and re-auth next time
}
wfDebugLog('SwiftBackend', get_class($e) . " in '{$func}' (given '" . FormatJson::encode($params) . "')" . ($e->getMessage() ? ": {$e->getMessage()}" : ""));
}
示例9: testGetMulti
/**
* @covers BagOStuff::getMulti
*/
public function testGetMulti()
{
$value1 = ['this' => 'is', 'a' => 'test'];
$value2 = ['this' => 'is', 'another' => 'test'];
$value3 = ['testing a key that may be encoded when sent to cache backend'];
$value4 = ['another test where chars in key will be encoded'];
$key1 = wfMemcKey('test1');
$key2 = wfMemcKey('test2');
// internally, MemcachedBagOStuffs will encode to will-%25-encode
$key3 = wfMemcKey('will-%-encode');
$key4 = wfMemcKey('flowdb:flow_ref:wiki:by-source:v3:Parser\'s_"broken"_+_(page)_&_grill:testwiki:1:4.7');
$this->cache->add($key1, $value1);
$this->cache->add($key2, $value2);
$this->cache->add($key3, $value3);
$this->cache->add($key4, $value4);
$this->assertEquals([$key1 => $value1, $key2 => $value2, $key3 => $value3, $key4 => $value4], $this->cache->getMulti([$key1, $key2, $key3, $key4]));
// cleanup
$this->cache->delete($key1);
$this->cache->delete($key2);
$this->cache->delete($key3);
$this->cache->delete($key4);
}
示例10: reset
/**
* Purges the internal and external cache of the site list, forcing the list
* of sites to be reloaded.
*
* @since 1.25
*/
public function reset()
{
// purge cache
$this->cache->delete($this->getCacheKey());
$this->sites = null;
}
示例11: doFlushCaches
/**
* @return void
*/
protected function doFlushCaches()
{
foreach (array('empty', 'size', 'acquiredcount') as $type) {
$this->cache->delete($this->getCacheKey($type));
}
}
示例12: delete
public function delete($key)
{
return $this->writeStore->delete($key);
}
示例13: clearCaches
public function clearCaches()
{
$key = $this->getLagTimeCacheKey();
$this->srvCache->delete($key);
$this->mainCache->delete($key);
}
示例14: doPurge
/**
* @see JobQueueAggregator::doPurge()
*/
protected function doPurge()
{
return $this->cache->delete($this->getReadyQueueCacheKey());
}
示例15: deleteOptionsKey
/**
* @param WikiPage $page
* @since 1.28
*/
public function deleteOptionsKey($page)
{
$this->mMemc->delete($this->getOptionsKey($page));
}