本文整理汇总了PHP中Smarty::clearAllCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::clearAllCache方法的具体用法?PHP Smarty::clearAllCache怎么用?PHP Smarty::clearAllCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty
的用法示例。
在下文中一共展示了Smarty::clearAllCache方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($name, array $values = array())
{
if (defined('ENV_DEV')) {
//$this->engine->clearCacheFiles();
//$this->engine->clearTemplateCache();
$this->engine->clearAllCache();
$this->engine->clearCompiledTemplate();
}
$template = $this->engine->createTemplate($name . $this->suffix);
$template->assign($values);
return $template->fetch();
}
示例2: CacheExpire
/**
* Expires the cache
*
* @param boolean $expireAll expire the whole cache
*/
public function CacheExpire($expireAll = false)
{
if ($expireAll) {
$this->tpl->clearAllCache();
return;
}
if (!$this->project) {
return;
}
$epoch = $this->GetProject()->GetEpoch();
if (empty($epoch)) {
return;
}
$age = $this->GetProject()->GetAge();
$this->tpl->clearCache(null, $this->GetCacheKeyPrefix(), null, $age);
$this->tpl->clearCache('projectlist.tpl', $this->GetCacheKeyPrefix(false), null, $age);
}
示例3: check_template_invalidation
/**
* Handle the lazy template cache invalidation
*
* @param string $template template name
* @param string $cache_id cache id
* @param string $compile_id compile id
*/
public function check_template_invalidation($template, $cache_id, $compile_id)
{
static $last_flush = null;
if (!file_exists($this->getCacheDir() . 'last_template_flush')) {
@touch($this->getCacheDir() . 'last_template_flush', time());
} elseif (defined('_DB_PREFIX_')) {
if ($last_flush === null) {
$sql = 'SELECT UNIX_TIMESTAMP(last_flush) as last_flush FROM `' . _DB_PREFIX_ . 'smarty_last_flush` WHERE type=\'template\'';
$last_flush = Db::getInstance()->getValue($sql, false);
}
if ((int) $last_flush && @filemtime($this->getCacheDir() . 'last_template_flush') < $last_flush) {
@touch($this->getCacheDir() . 'last_template_flush', time());
parent::clearAllCache();
} else {
if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
$cache_id = null;
}
if ($this->is_in_lazy_cache($template, $cache_id, $compile_id) === false) {
// insert in cache before the effective cache creation to avoid nasty race condition
$this->insert_in_lazy_cache($template, $cache_id, $compile_id);
parent::clearCache($template, $cache_id, $compile_id);
}
}
}
}
示例4: Smarty
global $config;
$config_tmp = $db->fetchAll($get_sysconf);
foreach ($config_tmp as $tmp) {
$config[$tmp['key']] = $tmp['value'];
}
//初始化smarty对象
global $smarty;
$smarty = new Smarty();
$smarty->setCompileDir(ROOT_PATH . 'data/compiles');
$smarty->setTemplateDir(ROOT_PATH . 'themes/' . $config['themes']);
$smarty->setCacheDir(ROOT_PATH . 'data/caches');
$smarty->setCacheLifetime(2);
//设置缓存文件超时时间为1800秒
//Debug模式下每次都强制编译输出
if ($debug_mode) {
$smarty->clearAllCache();
$smarty->clearCompiledTemplate();
$smarty->force_compile = true;
}
//设置系统设置
assign('config', $config);
//设置语言包
assign('LANG', $lang);
//设置网站参数
assign('config', $config);
//设置模板路径
assign('template_dir', 'themes/' . $config['themes'] . '/');
//读取ukey参数,记录推荐人信息
$ukey = getGET('ukey');
if ($ukey != '') {
$ukey = intval($ukey);
示例5: clearAllCache
public function clearAllCache($exp_time = null, $type = null)
{
return $this->smarty->clearAllCache($exp_time, $type);
}
示例6: clearCache
/**
* Clear cache for Smarty
*
* @param Smarty $smarty
*/
public static function clearCache($smarty, $tpl = false, $cache_id = null, $compile_id = null)
{
return $smarty->clearAllCache();
}
示例7: clearAllCache
public function clearAllCache()
{
$this->smarty->clearAllCache();
}