props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, true);              //是否缓存
     
props.AddProperty("file.resource.loader.modificationCheckInterval", (Int64)300);    //缓存时间(秒)    设置0以下为不检查  

 

无论如何每次访问页面,还都要读IO.   苦闷啊

 

无奈,只能这样自己缓存了:

 

 

代码
Template template_Content = (Template) DataCache.GetCache("tpl_" + templateFileName);

if (template_Content == null)
{
template_Content
= velocity.GetTemplate(templateFileName);
DataCache.SetCache(
"tpl_" + templateFileName, template_Content);
}

StringWriter writer
= new StringWriter();
template_Content.Merge(context, writer);

 

相关文章:

  • 2021-06-16
  • 2022-12-23
  • 2022-03-04
  • 2021-11-04
  • 2021-05-05
  • 2022-01-26
  • 2021-12-21
  • 2021-07-23
猜你喜欢
  • 2021-11-18
  • 2021-12-30
  • 2021-07-20
  • 2022-12-23
  • 2021-10-16
  • 2021-06-04
  • 2021-10-12
相关资源
相似解决方案