本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例6: uninstall
public function uninstall()
{
$this->drop_tables();
ConfigManager::delete('web', 'config');
CacheManager::invalidate('module', 'web');
WebService::get_keywords_manager()->delete_module_relations();
}
示例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;
}
示例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;
}
示例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 '';
}
}
示例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));
}
}
示例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;
}
示例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');
}
示例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;
}
示例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;
}
示例15: array
function &_getCache()
{
if (!isset($this->cache)) {
$cacheManager =& CacheManager::getManager();
$this->cache =& $cacheManager->getObjectCache('monographs', 0, array(&$this, '_cacheMiss'));
}
return $this->cache;
}