phpcms缓存使用总结(memcached、eaccelerator、shm) a.模板编译缓存 参考文件include/global.func.php及include/template.func.php 模板编译缓存的原理其实很简单,如果模板是第一次编译,则直接编译它,如果不是第一次编译,则比较模板文件($tplfile)及模板缓存文件 ($compiledtplfile)的修改时间,如果模板文件的修改时间大于编译过的模板缓存文件,则编译模板,否则不编译模板,提高了程序的执行效 率。 复制代码代码如下: function template($module = 'phpcms', $template = 'index') { global $CONFIG; $compiledtplfile = $CONFIG['templatescachedir',.$module.'_'.$template.'.tpl.php'; if($CONFIG['templaterefresh',) { $tplfile = PHPCMS_ROOT.'/templates/'.$CONFIG['defaulttemplate',.'/'.$module.'/'.$template.'.html'; if(!file_exists($compiledtplfile) || @filemtime($tplfile) > @filemtime($compiledtplfile)) { require_once PHPCMS_ROOT.'/include/template.func.php'; template_refresh($tplfile, $compiledtplfile); } } return $compiledtplfile; } b.在动态页面里面产生静态的缓存文件 与c的缓存原理类似,只是此处生成的...
内容已隐藏,请关注公众号输入验证码查看
本帖支持关注公众号查看
【无套路 无套路 无套路 扫描二维码关注公众号发送【验证码】收到验证码 在上面输入点击提交查看即可显示隐藏内容】
|