本文整理汇总了PHP中CCache::setCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CCache::setCache方法的具体用法?PHP CCache::setCache怎么用?PHP CCache::setCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCache
的用法示例。
在下文中一共展示了CCache::setCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
}
示例3: loadModelXml
private function loadModelXml()
{
$xmlFile = MODEL_PATH . $this->m_modelFile;
$cCache = new CCache($this->m_cConfig, $xmlFile);
if (file_exists($xmlFile) == false) {
throw new CError(ERROR_MODELSET_MODEL_FILE, array($this->m_modelName,
$xmlFile));
}
/*-
* Can it use cache? */
if ($cCache->useCache() == true) {
$xmlModels = $cCache->getCache();
/* push the modelName from the Model list */
$this->m_xmlSql = $xmlModels[$this->m_modelName];
}
/*-
* Read the xml file and cache it */
else {
$xmlData = new CXmlModel($xmlFile);
$xmlData->startParser();
$xmlModels = $xmlData->getXmlData();
if (array_key_exists($this->m_modelName, $xmlModels) == false) {
throw new CError(ERROR_MODELSET_NOT_FOUND, array($this->m_modelName,
$xmlFile));
}
/* set xmlSql from model with modelName */
$this->m_xmlSql = $xmlModels[$this->m_modelName];
/* cache */
$cCache->setCache($xmlModels);
}
/* init default data */
$this->m_isTable = &$this->m_xmlSql["xmlModelTable"];
$this->m_realName = &$this->m_xmlSql["xmlModelName"];
}
示例4: 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;
}