本文整理匯總了PHP中CacheManager::getManager方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheManager::getManager方法的具體用法?PHP CacheManager::getManager怎麽用?PHP CacheManager::getManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CacheManager
的用法示例。
在下文中一共展示了CacheManager::getManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}
}
示例2: 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;
}
示例3: 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 '';
}
}
示例4: 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;
}
示例5: 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');
}
示例6: _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;
}
示例7: array
function &_getArticlesInSectionsCache()
{
if (!isset($this->articlesInSectionsCache)) {
$cacheManager =& CacheManager::getManager();
$this->articlesInSectionsCache =& $cacheManager->getObjectCache('articlesInSections', 0, array(&$this, '_articlesInSectionsCacheMiss'));
}
return $this->articlesInSectionsCache;
}
示例8: 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;
}
示例9: array
function &_getCache()
{
if (!isset($this->cache)) {
$cacheManager =& CacheManager::getManager();
$this->cache =& $cacheManager->getObjectCache('monographs', 0, array(&$this, '_cacheMiss'));
}
return $this->cache;
}
示例10: 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;
}
示例11: import
function &_getCache()
{
static $settingCache;
if (!isset($settingCache)) {
import('cache.CacheManager');
$cacheManager =& CacheManager::getManager();
$settingCache = $cacheManager->getCache('siteSettings', 'site', array($this, '_cacheMiss'));
}
return $settingCache;
}
示例12: _getCache
/**
* Get an issue cache by cache ID.
* @param $cacheId string
* @return GenericCache
*/
function _getCache($cacheId)
{
if (!isset($this->caches)) {
$this->caches = array();
}
if (!isset($this->caches[$cacheId])) {
$cacheManager = CacheManager::getManager();
$this->caches[$cacheId] = $cacheManager->getObjectCache('issues', $cacheId, array($this, '_cacheMiss'));
}
return $this->caches[$cacheId];
}
示例13: 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();
}
}
示例14: clearDataCache
/**
* Clear the data cache.
* @param $args array
* @param $request PKPRequest
*/
function clearDataCache($args, $request)
{
// Clear the CacheManager's caches
$cacheManager = CacheManager::getManager();
$cacheManager->flush();
// Clear ADODB's cache
$userDao = DAORegistry::getDAO('UserDAO');
// As good as any
$userDao->flushCache();
$request->redirect(null, 'admin');
}
示例15: array
function &_getCache($journalId)
{
static $settingCache;
if (!isset($settingCache)) {
$settingCache = array();
}
if (!isset($settingCache[$journalId])) {
$cacheManager =& CacheManager::getManager();
$settingCache[$journalId] =& $cacheManager->getFileCache('journalSettings', $journalId, array($this, '_cacheMiss'));
}
return $settingCache[$journalId];
}