本文整理汇总了PHP中CacheManager类的典型用法代码示例。如果您正苦于以下问题:PHP CacheManager类的具体用法?PHP CacheManager怎么用?PHP CacheManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CacheManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: array
/**
* Get supp file objects cache.
* @return GenericCache
*/
function &_getSuppFileCache()
{
if (!isset($this->suppFileCache)) {
$cacheManager =& CacheManager::getManager();
$this->suppFileCache =& $cacheManager->getObjectCache('suppfile', 0, array(&$this, '_suppFileCacheMiss'));
}
return $this->suppFileCache;
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:12,代码来源:SuppFileDAO.inc.php
示例17: array
function &_getArticlesInSectionsCache()
{
if (!isset($this->articlesInSectionsCache)) {
$cacheManager =& CacheManager::getManager();
$this->articlesInSectionsCache =& $cacheManager->getObjectCache('articlesInSections', 0, array(&$this, '_articlesInSectionsCacheMiss'));
}
return $this->articlesInSectionsCache;
}
开发者ID:jasonzou,项目名称:OJS-2.4.6,代码行数:8,代码来源:PublishedArticleDAO.inc.php
示例18: array
function &_getCache()
{
$settingCache =& Registry::get('siteSettingCache', true, null);
if ($settingCache === null) {
$cacheManager =& CacheManager::getManager();
$settingCache = $cacheManager->getFileCache('siteSettings', 'site', array($this, '_cacheMiss'));
}
return $settingCache;
}
开发者ID:master3395,项目名称:CBPPlatform,代码行数:9,代码来源:SiteSettingsDAO.inc.php
示例19: import
function &_getCache()
{
static $settingCache;
if (!isset($settingCache)) {
import('cache.CacheManager');
$cacheManager =& CacheManager::getManager();
$settingCache = $cacheManager->getCache('siteSettings', 'site', array($this, '_cacheMiss'));
}
return $settingCache;
}
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:10,代码来源:SiteSettingsDAO.inc.php
示例20: setUp
protected function setUp()
{
$this->cacheManager = CacheManager::getManager();
$this->cacheMisses = 0;
if (!is_writable($this->cacheManager->getFileCachePath())) {
$this->markTestSkipped('File cache path not writable.');
} else {
parent::setUp();
$this->cacheManager->flush();
}
}
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:11,代码来源:FileCacheTest.php
注:本文中的CacheManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论