本文整理汇总了PHP中CacheManager::getCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheManager::getCache方法的具体用法?PHP CacheManager::getCache怎么用?PHP CacheManager::getCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheManager
的用法示例。
在下文中一共展示了CacheManager::getCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: array
<?php
/**
* General example for the Cache component.
*
* @package Cache
* @version 1.4.1
* @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/new_bsd New BSD License
*/
/**
* Content view
*/
// Assuming that the ContentView cache has been initialized correctly in the
// index.php:
// First retreive tha cache you want to access from the manager.
$cache = CacheManager::getCache('ContentView');
// Prepare your data identification, use some attributes and a unique ID
$attributes = array('user' => $user, 'nodeid' => $NodeID, 'offset' => $Offset, 'layout' => $layout, 'lang' => $LanguageCode, 'vmode' => $ViewMode);
$id = getUniqueId($attributes, $viewParameters);
// Initialize data and try to grep from cache
$data = '';
if (($data = $cache->restore($id, $attributes)) === false) {
// No data in cache or data has expired. Generate new data...
// What ever exactly happens to create it in eZp.
$data = generateMyData();
// ... and store it inside the cache
$cache->store($id, $attributes, $data);
}
// And that's all! : )
示例4: getRoutingData
/**
* gets the cache from the cacheManager
*
* @return array
*/
public function getRoutingData()
{
return $this->manager->getCache();
}