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


PHP CacheManager類代碼示例

本文整理匯總了PHP中CacheManager的典型用法代碼示例。如果您正苦於以下問題:PHP CacheManager類的具體用法?PHP CacheManager怎麽用?PHP CacheManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: initDataProvider

function initDataProvider($connection = false)
{
    global $CONFIG, $DB_CONNECTOR, $CM;
    if (!empty($CONFIG["gl_datprov"])) {
        if (!defined("DB_PREFIX")) {
            define("DB_PREFIX", $CONFIG["gl_db_prefix"]);
        }
        $DB_CONNECTOR = new DBManager($CONFIG["gl_db_user"], $CONFIG["gl_db_pass"], $CONFIG["gl_db_host"], $CONFIG["gl_db_name"], $CONFIG["gl_db_prefix"]);
        if (!empty($CONFIG["gl_db_ext"])) {
            DBManager::$Extension = $CONFIG["gl_db_ext"];
        }
        if ($DB_CONNECTOR->InitConnection()) {
            $connection = true;
        }
    }
    if (!defined("DB_CONNECTION")) {
        define("DB_CONNECTION", $connection);
    }
    if ($connection) {
        loadDatabaseConfig(false, $CONFIG["gl_db_prefix"]);
        if (!isset($CONFIG["gl_caen"])) {
            $CONFIG["gl_caen"] = 1;
        }
        if (!isServerSetup() && !is("IN_API") && CacheManager::CachingAvailable($CONFIG["gl_caen"]) !== false) {
            $gttl = min($CONFIG["poll_frequency_clients"], $CONFIG["poll_frequency_tracking"]) * 2;
            $sttl = !empty($CONFIG["gl_st_upin"]) ? $CONFIG["gl_st_upin"] : 3600;
            $CM = new CacheManager(md5(SUBSITEHOST . $CONFIG["gl_lzid"] . $CONFIG["gl_db_prefix"] . $CONFIG["gl_db_pass"] . $CONFIG["gl_db_user"] . $CONFIG["gl_db_name"]), $gttl, array(111 => array("VISITOR", 512), 112 => array("EVENTS", 128), 113 => array("INTERNAL", 256, $gttl * 2), 114 => array("GROUPS", 256, $gttl * 2), 115 => array("FILTERS", 128, $gttl * 2), 116 => array("DBCNF", 128, $gttl * 2), 117 => array("STATS", 1, $sttl), 118 => array("DUT", 1)));
            $CM->Read();
        }
        loadDatabaseConfig(true, $CONFIG["gl_db_prefix"]);
    }
    return $connection;
}
開發者ID:elderxavier,項目名稱:SII9-CREATIVE-STUDIO,代碼行數:33,代碼來源:functions.global.inc.php

示例2: create

 /**
  * This method has side effects, so it is not the constructor.
  *
  * @param ClassFinderInterface $finder
  * @param CacheManager $cacheManager
  *
  * @return self
  *
  * @throws \Exception
  */
 static function create($finder, $cacheManager)
 {
     /** @var self $loader */
     $loader = new static($finder);
     $cacheManager->observeCachePrefix($loader);
     return $loader;
 }
開發者ID:nishantkumar155,項目名稱:drupal8.crackle,代碼行數:17,代碼來源:AbstractQueuedCachedClassLoader.php

示例3: testGetCache

 /**
  * @covers Xoops\Core\Cache\CacheManager::getCache
  */
 public function testGetCache()
 {
     $pool1 = $this->object->getCache('default');
     $this->assertInstanceOf('Xoops\\Core\\Cache\\Access', $pool1);
     $pool2 = $this->object->getCache('nosuchpooldefinition');
     $this->assertInstanceOf('Xoops\\Core\\Cache\\Access', $pool2);
     $this->assertSame($pool1, $pool2);
 }
開發者ID:RanLee,項目名稱:XoopsCore,代碼行數:11,代碼來源:CacheManagerTest.php

示例4: create

 /**
  * This method has side effects, so it is not the constructor.
  *
  * @param ClassFinderInterface $finder
  * @param CacheManager $cacheManager
  *
  * @return self
  *
  * @throws \Exception
  */
 static function create($finder, $cacheManager)
 {
     /** @var self $loader */
     $loader = new static($finder);
     if (!$loader->checkRequirements()) {
         $class = get_class($loader);
         throw new CacheNotSupportedException("Unable to use {$class}, because the respetive PHP extension is not enabled.");
     }
     $cacheManager->observeCachePrefix($loader);
     return $loader;
 }
開發者ID:nishantkumar155,項目名稱:drupal8.crackle,代碼行數:21,代碼來源:AbstractCachedClassLoader.php

示例5: execute

 /**
  * Test locales.
  */
 function execute()
 {
     // Flush the file cache just to be certain we're using
     // the most recent stuff
     import('cache.CacheManager');
     $cacheManager =& CacheManager::getManager();
     $cacheManager->flush('locale');
     // Load plugins so that their locale data is included too
     $plugins = array();
     foreach (PluginRegistry::getCategories() as $category) {
         echo "Loading plugin category \"{$category}\"...\n";
         $morePlugins = PluginRegistry::loadCategory($category);
         if (is_array($morePlugins)) {
             $plugins += $morePlugins;
         }
     }
     foreach (Locale::getAllLocales() as $locale => $name) {
         if (!empty($this->locales) && !in_array($locale, $this->locales)) {
             continue;
         }
         if ($locale != MASTER_LOCALE) {
             echo "Testing locale \"{$name}\" ({$locale}) against reference locale " . MASTER_LOCALE . ".\n";
             $this->testLocale($locale, MASTER_LOCALE, $plugins);
             $this->testEmails($locale, MASTER_LOCALE);
         }
     }
 }
開發者ID:jalperin,項目名稱:harvester,代碼行數:30,代碼來源:localeCheck.php

示例6: uninstall

 public function uninstall()
 {
     $this->drop_tables();
     ConfigManager::delete('web', 'config');
     CacheManager::invalidate('module', 'web');
     WebService::get_keywords_manager()->delete_module_relations();
 }
開發者ID:AroundPBT,項目名稱:PHPBoost,代碼行數:7,代碼來源:WebSetup.class.php

示例7: clearDataCache

 /**
  * Clear the data cache files (needed because of direct tinkering
  * with settings tables)
  * @return boolean
  */
 function clearDataCache()
 {
     $cacheManager = CacheManager::getManager();
     $cacheManager->flush(null, CACHE_TYPE_FILE);
     $cacheManager->flush(null, CACHE_TYPE_OBJECT);
     return true;
 }
開發者ID:laelnasan,項目名稱:UTFPR-ojs,代碼行數:12,代碼來源:Upgrade.inc.php

示例8: getCachingFrameworkRequiredDatabaseSchema

 /**
  * Get schema SQL of required cache framework tables.
  *
  * This method needs ext_localconf and ext_tables loaded!
  *
  * @return string Cache framework SQL
  */
 public function getCachingFrameworkRequiredDatabaseSchema()
 {
     // Use new to circumvent the singleton pattern of CacheManager
     $cacheManager = new CacheManager();
     $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
     // Cache manager needs cache factory. cache factory injects itself to manager in __construct()
     new CacheFactory('production', $cacheManager);
     $tableDefinitions = '';
     foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $cacheName => $_) {
         $backend = $cacheManager->getCache($cacheName)->getBackend();
         if (method_exists($backend, 'getTableDefinitions')) {
             $tableDefinitions .= LF . $backend->getTableDefinitions();
         }
     }
     return $tableDefinitions;
 }
開發者ID:rickymathew,項目名稱:TYPO3.CMS,代碼行數:23,代碼來源:DatabaseSchemaService.php

示例9: getContents

 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     $cacheManager =& CacheManager::getManager();
     $cache =& $cacheManager->getFileCache('keywords_' . AppLocale::getLocale(), $journal->getId(), array(&$this, '_cacheMiss'));
     // If the cache is older than a couple of days, regenerate it
     if (time() - $cache->getCacheTime() > 60 * 60 * 24 * KEYWORD_BLOCK_CACHE_DAYS) {
         $cache->flush();
     }
     $keywords =& $cache->getContents();
     if (empty($keywords)) {
         return '';
     }
     // Get the max occurrences for all keywords
     $maxOccurs = array_shift(array_values($keywords));
     // Now sort the array alphabetically
     ksort($keywords);
     $page = Request::getRequestedPage();
     $op = Request::getRequestedOp();
     $templateMgr->assign_by_ref('cloudKeywords', $keywords);
     $templateMgr->assign_by_ref('maxOccurs', $maxOccurs);
     if ($page == 'index' && $op == 'index' || $page == 'issue' || $page == 'search') {
         return parent::getContents($templateMgr);
     } else {
         return '';
     }
 }
開發者ID:yuricampos,項目名稱:ojs,代碼行數:32,代碼來源:KeywordCloudBlockPlugin.inc.php

示例10: actionView

 function actionView()
 {
     header('Content-type: application/json');
     if (!IjoyPlusServiceUtils::validateAPPKey()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
         return;
     }
     //		if(Yii::app()->user->isGuest){
     //			IjoyPlusServiceUtils::exportServiceError(Constants::SEESION_IS_EXPIRED);
     //			return ;
     //		}
     $thread_id = Yii::app()->request->getParam("thread_id");
     if (!isset($thread_id) || is_null($thread_id)) {
         IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
         return;
     }
     $comment = CacheManager::getCommentCache($thread_id);
     if ($comment === null) {
         IjoyPlusServiceUtils::exportEntity(array('comment' => array()));
     } else {
         $temp = IjoyPlusServiceUtils::transferComments($comment);
         $comments = Comment::model()->getCommentReplies($thread_id, 10, 0);
         $commentTemps = array();
         if (isset($comments) && is_array($comments)) {
             foreach ($comments as $comment) {
                 $commentTemps[] = IjoyPlusServiceUtils::transferComments($comment);
             }
         }
         $temp->replies = $commentTemps;
         IjoyPlusServiceUtils::exportEntity(array('comment' => $temp));
     }
 }
開發者ID:andyongithub,項目名稱:joyplus-cms,代碼行數:32,代碼來源:CommentController.php

示例11: exportProgramEntity

 public static function exportProgramEntity($program)
 {
     $prod = array();
     switch (CacheManager::getTopParentType($program->d_type)) {
         case Constants::PROGRAM_TYPE_TV:
             $prod['tv'] = ProgramUtil::genTV($program, true);
             break;
         case Constants::PROGRAM_ANIMATION:
             $prod['tv'] = ProgramUtil::genTV($program, true);
             break;
         case Constants::PROGRAM_TYPE_SHOW:
             $prod['show'] = ProgramUtil::genTV($program, false);
             break;
         case Constants::PROGRAM_TYPE_MOVIE:
             $prod['movie'] = ProgramUtil::genTV($program, true);
             break;
         case Constants::PROGRAM_TYPE_VIDEO:
             $prod['video'] = ProgramUtil::genMovie($program);
             break;
         case Constants::PROGRAM_TYPE_RECORD:
             $prod['show'] = ProgramUtil::genTV($program, false);
             break;
     }
     return $prod;
 }
開發者ID:andyongithub,項目名稱:joyplus-cms,代碼行數:25,代碼來源:ProgramUtil.php

示例12: clearDataCache

 /**
  * Clear the data cache.
  */
 function clearDataCache($args, &$request)
 {
     $this->validate();
     import('lib.pkp.classes.cache.CacheManager');
     $cacheManager =& CacheManager::getManager($request);
     $cacheManager->flush();
     $request->redirect('admin');
 }
開發者ID:Rygbee,項目名稱:harvester,代碼行數:11,代碼來源:AdminFunctionsHandler.inc.php

示例13: array

 /**
  * Get galley objects cache.
  * @return GenericCache
  */
 function &_getGalleyCache()
 {
     if (!isset($this->galleyCache)) {
         $cacheManager =& CacheManager::getManager();
         $this->galleyCache =& $cacheManager->getObjectCache('galley', 0, array(&$this, '_galleyCacheMiss'));
     }
     return $this->galleyCache;
 }
開發者ID:farhanabbas1983,項目名稱:ojs-1,代碼行數:12,代碼來源:ArticleGalleyDAO.inc.php

示例14: _getCache

 /**
  * Get the submission cache.
  * @return Cache
  */
 function _getCache()
 {
     if (!isset($this->cache)) {
         $cacheManager = CacheManager::getManager();
         $this->cache = $cacheManager->getObjectCache('submissions', 0, array(&$this, '_cacheMiss'));
     }
     return $this->cache;
 }
開發者ID:energylevels,項目名稱:pkp-lib,代碼行數:12,代碼來源:SubmissionDAO.inc.php

示例15: array

 function &_getCache()
 {
     if (!isset($this->cache)) {
         $cacheManager =& CacheManager::getManager();
         $this->cache =& $cacheManager->getObjectCache('monographs', 0, array(&$this, '_cacheMiss'));
     }
     return $this->cache;
 }
開發者ID:ramonsodoma,項目名稱:omp,代碼行數:8,代碼來源:MonographDAO.inc.php


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