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