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


PHP BagOStuff::delete方法代码示例

本文整理汇总了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;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:CachedBagOStuff.php

示例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
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:30,代码来源:JobQueueAggregatorMemc.php

示例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;
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:15,代码来源:SwiftFileBackend.php

示例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();
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:10,代码来源:JobQueueFederated.php

示例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}" : ""));
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:22,代码来源:SwiftFileBackend.php

示例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);
 }
开发者ID:ErdemA,项目名称:mediawiki,代码行数:16,代码来源:BagOStuffTest.php

示例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);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:21,代码来源:BagOStuffTest.php

示例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()}" : ""));
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:30,代码来源:SwiftFileBackend.php

示例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);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:25,代码来源:BagOStuffTest.php

示例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;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:12,代码来源:CachingSiteStore.php

示例11: doFlushCaches

 /**
  * @return void
  */
 protected function doFlushCaches()
 {
     foreach (array('empty', 'size', 'acquiredcount') as $type) {
         $this->cache->delete($this->getCacheKey($type));
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:9,代码来源:JobQueueDB.php

示例12: delete

 public function delete($key)
 {
     return $this->writeStore->delete($key);
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:4,代码来源:ReplicatedBagOStuff.php

示例13: clearCaches

 public function clearCaches()
 {
     $key = $this->getLagTimeCacheKey();
     $this->srvCache->delete($key);
     $this->mainCache->delete($key);
 }
开发者ID:sftsk,项目名称:mediawiki,代码行数:6,代码来源:LoadMonitorMySQL.php

示例14: doPurge

 /**
  * @see JobQueueAggregator::doPurge()
  */
 protected function doPurge()
 {
     return $this->cache->delete($this->getReadyQueueCacheKey());
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:7,代码来源:JobQueueAggregatorMemc.php

示例15: deleteOptionsKey

 /**
  * @param WikiPage $page
  * @since 1.28
  */
 public function deleteOptionsKey($page)
 {
     $this->mMemc->delete($this->getOptionsKey($page));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:ParserCache.php


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