當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ObjectCache::clear方法代碼示例

本文整理匯總了PHP中ObjectCache::clear方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectCache::clear方法的具體用法?PHP ObjectCache::clear怎麽用?PHP ObjectCache::clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ObjectCache的用法示例。


在下文中一共展示了ObjectCache::clear方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: prepareEnvironment

 protected function prepareEnvironment()
 {
     global $wgMemc;
     // Don't share DB, storage, or memcached connections
     wfGetLBFactory()->destroyInstance();
     FileBackendGroup::destroySingleton();
     LockManagerGroup::destroySingletons();
     ObjectCache::clear();
     $wgMemc = null;
 }
開發者ID:mangowi,項目名稱:mediawiki,代碼行數:10,代碼來源:ForkController.php

示例2: prepareEnvironment

 protected function prepareEnvironment()
 {
     global $wgMemc;
     // Don't share DB, storage, or memcached connections
     MediaWikiServices::resetChildProcessServices();
     FileBackendGroup::destroySingleton();
     LockManagerGroup::destroySingletons();
     JobQueueGroup::destroySingletons();
     ObjectCache::clear();
     RedisConnectionPool::destroySingletons();
     $wgMemc = null;
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:12,代碼來源:ForkController.php

示例3: __construct

 /**
  * Constructor, always call this from child classes.
  */
 public function __construct()
 {
     global $wgMessagesDirs, $wgUser;
     // Disable the i18n cache
     Language::getLocalisationCache()->disableBackend();
     // Disable LoadBalancer and wfGetDB etc.
     LBFactory::disableBackend();
     // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
     // SqlBagOStuff will then throw since we just disabled wfGetDB)
     $GLOBALS['wgMemc'] = new EmptyBagOStuff();
     ObjectCache::clear();
     $emptyCache = array('class' => 'EmptyBagOStuff');
     $GLOBALS['wgObjectCaches'] = array(CACHE_NONE => $emptyCache, CACHE_DB => $emptyCache, CACHE_ANYTHING => $emptyCache, CACHE_MEMCACHED => $emptyCache);
     // Load the installer's i18n.
     $wgMessagesDirs['MediawikiInstaller'] = __DIR__ . '/i18n';
     // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
     $wgUser = User::newFromId(0);
     $this->settings = $this->internalDefaults;
     foreach ($this->defaultVarNames as $var) {
         $this->settings[$var] = $GLOBALS[$var];
     }
     $this->doEnvironmentPreps();
     $this->compiledDBs = array();
     foreach (self::getDBTypes() as $type) {
         $installer = $this->getDBInstaller($type);
         if (!$installer->isCompiled()) {
             continue;
         }
         $this->compiledDBs[] = $type;
     }
     $this->parserTitle = Title::newFromText('Installer');
     $this->parserOptions = new ParserOptions();
     // language will be wrong :(
     $this->parserOptions->setEditSection(false);
 }
開發者ID:D66Ha,項目名稱:mediawiki,代碼行數:38,代碼來源:Installer.php

示例4: prepareEnvironment

 protected function prepareEnvironment()
 {
     global $wgMemc;
     // Don't share DB or memcached connections
     wfGetLBFactory()->destroyInstance();
     ObjectCache::clear();
     $wgMemc = null;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:8,代碼來源:ForkController.php

示例5: SweeterTweetReader

<?php

/**
 * The sweeter tweet reader agent handles the background requests when given a proper nonce.
 */
require_once '../sweeter_tweet_reader.php';
if (isset($_REQUEST['sweeter_tweet_reader_nonce'])) {
    // retrieve the model and config from the nonce
    $sweet_tweet = new SweeterTweetReader();
    $update = new ObjectCache($_REQUEST['sweeter_tweet_reader_nonce'], 999999999);
    $data = $update->fetch();
    if (!empty($data)) {
        $sweet_tweet->set($data['model']);
        $sweet_tweet->config($data['config']);
        $sweet_tweet->update();
    }
    $update->clear();
}
開發者ID:natepixel,項目名稱:SweeterTweetReader,代碼行數:18,代碼來源:agent.php

示例6: doLightweightServiceReset

 /**
  * Resets some well known services that typically have state that may interfere with unit tests.
  * This is a lightweight alternative to resetGlobalServices().
  *
  * @note There is no guarantee that no references remain to stale service instances destroyed
  * by a call to doLightweightServiceReset().
  *
  * @throws MWException if called outside of PHPUnit tests.
  *
  * @see resetGlobalServices()
  */
 private function doLightweightServiceReset()
 {
     global $wgRequest;
     JobQueueGroup::destroySingletons();
     ObjectCache::clear();
     $services = MediaWikiServices::getInstance();
     $services->resetServiceForTesting('MainObjectStash');
     $services->resetServiceForTesting('LocalServerObjectCache');
     $services->getMainWANObjectCache()->clearProcessCache();
     FileBackendGroup::destroySingleton();
     // TODO: move global state into MediaWikiServices
     RequestContext::resetMain();
     if (session_id() !== '') {
         session_write_close();
         session_id('');
     }
     $wgRequest = new FauxRequest();
     MediaWiki\Session\SessionManager::resetCache();
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:30,代碼來源:MediaWikiTestCase.php

示例7: doLightweightServiceReset

 /**
  * Resets some well known services that typically have state that may interfere with unit tests.
  * This is a lightweight alternative to resetGlobalServices().
  *
  * @note There is no guarantee that no references remain to stale service instances destroyed
  * by a call to doLightweightServiceReset().
  *
  * @throws MWException if called outside of PHPUnit tests.
  *
  * @see resetGlobalServices()
  */
 private function doLightweightServiceReset()
 {
     global $wgRequest;
     JobQueueGroup::destroySingletons();
     ObjectCache::clear();
     FileBackendGroup::destroySingleton();
     // TODO: move global state into MediaWikiServices
     RequestContext::resetMain();
     MediaHandler::resetCache();
     if (session_id() !== '') {
         session_write_close();
         session_id('');
     }
     $wgRequest = new FauxRequest();
     MediaWiki\Session\SessionManager::resetCache();
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:27,代碼來源:MediaWikiTestCase.php


注:本文中的ObjectCache::clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。