本文整理汇总了PHP中CCache类的典型用法代码示例。如果您正苦于以下问题:PHP CCache类的具体用法?PHP CCache怎么用?PHP CCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCache类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: tearDown
/**
* Teardown environment
*
* @return void
*/
protected function tearDown()
{
$cache = new CCache();
$cache->setDir(CACHE_PATH);
$this->removeFilesInCacheDir();
$cache->removeSubdir(self::DUMMY);
}
开发者ID:szunyi,项目名称:cimage,代码行数:12,代码来源:CImageDummyTest.php
示例2: loadPageXml
private function loadPageXml($xmlFile)
{
/* init */
$file = CONTROLLER_PATH . $xmlFile;
$this->m_fileName = $xmlFile;
$cCache = new CCache($this->m_cConfig, $file);
$retXml = array();
/**
* Can it use cache? */
if ($cCache->useCache() == true) {
$retXml = $cCache->getCache();
}
/**
* Read the xml file and cache it */
else {
$xmlData = new CXmlController($file);
$xmlData->setDefaultType("string-iso");
$xmlData->startParser();
$retXml = $xmlData->getXmlData();
/* cache */
$cCache->setCache($retXml);
}
return $retXml;
}
开发者ID:BackupTheBerlios,项目名称:sestreamvc-svn,代码行数:28,代码来源:CPage.php
示例3: loadUrl
public function loadUrl()
{
/* init cache object */
$cCache = new CCache($this->m_cConfig, $this->m_xmlFile);
/* if it can use the cache, I use it or I cache it! */
if ($cCache->useCache == true) {
$urlX = $cCache->getCache();
}
/**
* Cache config */
else {
$xmlData = new CXmlController($this->m_xmlFile);
$xmlData->setDefaultType("string-utf8");
$xmlData->startParser();
$urlX = $xmlData->getXmlData();
/* cache it for next one */
$cCache->setCache($urlX);
}
/* erstelle m_urlXml */
$this->assocUrl($urlX);
}
开发者ID:BackupTheBerlios,项目名称:sestreamvc-svn,代码行数:25,代码来源:CPageUrl.php
示例4: getCacheProxy
/**
* @return CCache
*/
protected function getCacheProxy()
{
if (is_null($this->_cacheProxy)) {
$this->_cacheProxy = Yii::createComponent($this->cache);
$this->_cacheProxy->init();
}
return $this->_cacheProxy;
}
开发者ID:pendalff,项目名称:yii-debug-toolbar,代码行数:11,代码来源:YiiDebugCacheProxy.php
示例5: render
protected function render($view, $controller = "site", $arrResult = array(), $template = TEMPLATE)
{
$cache = new CCache(604800);
$flagCache = false;
if (!$cache->cacheExists(CApp::getHashCurPage()) && false) {
$flagCache = true;
$cache->startCache();
}
include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/header.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/views/" . strtolower($controller) . "/" . $view . ".php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/footer.php";
if ($flagCache) {
$cache->writeCache(filterGetValue(CApp::getHashCurPage()));
}
}
开发者ID:ennjamusic,项目名称:study,代码行数:15,代码来源:CController.php
示例6: __construct
public function __construct(&$db)
{
parent::__construct('#__community_config', 'name', $db);
// Get cache object.
$oCache = CCache::inject($this);
// Remove all cache on configuration change.
$oCache->addMethod(CCache::METHOD_STORE, CCache::ACTION_REMOVE, COMMUNITY_CACHE_TAG_ALL);
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:8,代码来源:configuration.php
示例7: deleteCache
/**
* Delete cahche on request.
**/
function deleteCache($method)
{
if ($oCache = CCache::load($this)) {
if ($aSetting = $oCache->getMethod($method)) {
$oCache->remove($aSetting['tag']);
}
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:11,代码来源:cache.php
示例8: CTableVideosCategory
/**
* Constructor
*/
function CTableVideosCategory(&$db)
{
parent::__construct('#__community_videos_category', 'id', $db);
// Get cache object.
$oCache = CCache::inject($this);
// Remove video cache on every delete & store
$oCache->addMethod(CCache::METHOD_DEL, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_VIDEOS_CAT));
$oCache->addMethod(CCache::METHOD_STORE, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_VIDEOS_CAT));
}
开发者ID:bizanto,项目名称:Hooked,代码行数:12,代码来源:videoscategory.php
示例9: render
protected function render($view, $controller = "site", $arrResult = [], $template = null)
{
if ($template == null) {
$template = CApp::settings('APPLICATION')->templates['default'];
}
$cache = new CCache(604800);
$flagCache = false;
if (!$cache->cacheExists(CApp::getHashCurPage()) && CApp::settings("APPLICATION")->settings['cache_on']) {
$flagCache = true;
$cache->startCache();
}
include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/header.php";
include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/views/" . strtolower($controller) . "/" . $view . ".php";
include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/footer.php";
if ($flagCache) {
$cache->writeCache(filterGetValue(CApp::getHashCurPage()));
}
}
开发者ID:ennjamusic,项目名称:study,代码行数:18,代码来源:CController.php
示例10: __construct
/**
* Constructor
*/
public function __construct(&$db)
{
parent::__construct('#__community_events', 'id', $db);
// Get cache object.
$oCache = CCache::inject($this);
// Remove video cache on every delete & store
$oCache->addMethod(CCache::METHOD_DEL, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_EVENTS, COMMUNITY_CACHE_TAG_EVENTS_CAT));
$oCache->addMethod(CCache::METHOD_STORE, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_EVENTS, COMMUNITY_CACHE_TAG_EVENTS_CAT));
}
开发者ID:bizanto,项目名称:Hooked,代码行数:12,代码来源:event.php
示例11: __construct
/**
* Constructor
*/
public function __construct(&$db)
{
parent::__construct('#__community_groups_category', 'id', $db);
// Get cache object.
$oCache = CCache::inject($this);
// Remove groups category cache on every delete & store
$oCache->addMethod(CCache::METHOD_DEL, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_GROUPS_CAT));
$oCache->addMethod(CCache::METHOD_STORE, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_GROUPS_CAT));
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:12,代码来源:groupcategory.php
示例12: __construct
/**
* Constructor
*/
function __construct(&$db)
{
parent::__construct('#__community_photos_albums', 'id', $db);
// Get cache object.
$oCache = CCache::inject($this);
// Remove photo cache on album delete.
$oCache->addMethod(CCache::METHOD_DEL, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_PHOTOS));
$oCache->addMethod(CCache::METHOD_STORE, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_ALBUMS));
}
开发者ID:bizanto,项目名称:Hooked,代码行数:12,代码来源:album.php
示例13: loadConfig
public function loadConfig($xmlFile)
{
$xmlFile = $this->m_path + $xmlFile;
/* init cache object for config file */
$cCache = new CCache($this->m_cConf, $xmlFile);
/* if I can use the cache, I use it or I cache it! */
if ($cCache->useCache == true) {
$this->m_config = $cCache->getCache();
}
/**
* Cache config */
else {
parent::loadConfig($xmlFile);
$cCache->setCache($this->m_config);
}
}
开发者ID:BackupTheBerlios,项目名称:sestreamvc-svn,代码行数:18,代码来源:CPlugInConfig.php
示例14: __construct
function __construct()
{
// Get cache object.
$oCache = CCache::inject($this);
$oCache->addMethod('add', CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_ACTIVITIES));
$oCache->addMethod('removeOneActivity', CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_ACTIVITIES));
$oCache->addMethod('removeActivity', CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_ACTIVITIES));
$oCache->addMethod('deleteActivity', CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_ACTIVITIES));
parent::__construct();
}
开发者ID:bizanto,项目名称:Hooked,代码行数:10,代码来源:activities.php
示例15: __construct
/**
* Constructor
*/
public function __construct(&$db)
{
parent::__construct('#__community_events', 'id', $db);
// Get cache object.
$oCache = CCache::inject($this);
// Remove video cache on every delete & store
$oCache->addMethod(CCache::METHOD_DEL, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_EVENTS, COMMUNITY_CACHE_TAG_EVENTS_CAT));
$oCache->addMethod(CCache::METHOD_STORE, CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_EVENTS, COMMUNITY_CACHE_TAG_EVENTS_CAT));
// Set default timezone to current user's timezone
$my = CFactory::getUser();
$this->offset = $my->getParam('timezone');
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:15,代码来源:event.php
示例16: CommunityModelGroups
/**
* Constructor
*/
public function CommunityModelGroups()
{
parent::JCCModel();
$mainframe = JFactory::getApplication();
// Get pagination request variables
$limit = $mainframe->getCfg('list_limit') == 0 ? 5 : $mainframe->getCfg('list_limit');
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
// In case limit has been changed, adjust it
$limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
// Get cache object.
$oCache = CCache::inject($this);
$oCache->addMethod('setImage', CCache::ACTION_REMOVE, array(COMMUNITY_CACHE_TAG_GROUPS));
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:18,代码来源:groups.php
示例17: init
/**
* Initializes this application component.
* This method is required by the {@link IApplicationComponent} interface.
* It checks the availability of eAccelerator.
* @throws CException if eAccelerator extension is not loaded, is disabled or the cache functions are not compiled in.
*/
public function init()
{
parent::init();
if (!function_exists('eaccelerator_get')) {
throw new CException(Yii::t('yii', 'CEAcceleratorCache requires PHP eAccelerator extension to be loaded, enabled or compiled with the "--with-eaccelerator-shared-memory" option.'));
}
}
开发者ID:alsvader,项目名称:hackbanero,代码行数:13,代码来源:CEAcceleratorCache.php
示例18: init
/**
* Initializes this application component.
* This method is required by the {@link IApplicationComponent} interface.
* It checks the availability of memcache.
* @throws CException if memcache extension is not loaded or is disabled.
*/
public function init()
{
parent::init();
if (!function_exists('xcache_isset')) {
throw new CException(Yii::t('yii', 'CXCache requires PHP XCache extension to be loaded.'));
}
}
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:13,代码来源:CXCache.php
示例19: init
/**
* Initializes this application component.
* This method is required by the {@link IApplicationComponent} interface.
* It checks the availability of APC.
* @throws CException if APC cache extension is not loaded or is disabled.
*/
public function init()
{
parent::init();
if (!extension_loaded('apc')) {
throw new CException(Yii::t('yii', 'CApcCache requires PHP apc extension to be loaded.'));
}
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:13,代码来源:CApcCache.php
示例20: init
/**
* Initializes this application component.
* ensureIndex 'key' if $ensureIndex = true
* Set $ensureIndex to false after first use to increase performance
*
* This method is required by the {@link IApplicationComponent} interface.
* It ensures the existence of the cache DB table.
* It also removes expired data items from the cache.
*/
public function init()
{
parent::init();
if ($this->ensureIndex) {
$this->getCollection()->createIndex(['key' => 1]);
// create index on "key"
}
}
开发者ID:yiicod,项目名称:mongoyii,代码行数:17,代码来源:EMongoCache.php
注:本文中的CCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论