第一要在web.xml中加入以下配置
<taglib>
<taglib-uri>oscache</taglib-uri>
<taglib-location>/WEB-INF/classes/oscache.tld</taglib-location>
</taglib>
第二在/web-inf/lib下加入os的jar包
第三在/web-inf/classes下加入oscache的配置文件和tld
第四在freemarker中按如下方法使用
<#assign cache=JspTaglibs["/WEB-INF/classes/oscache.tld"] />
<@cache.cache key="xxx" time=20>
${fowUrlaa}
</@cache.cache>
<taglib>
<taglib-uri>oscache</taglib-uri>
<taglib-location>/WEB-INF/classes/oscache.tld</taglib-location>
</taglib>
第二在/web-inf/lib下加入os的jar包
第三在/web-inf/classes下加入oscache的配置文件和tld
第四在freemarker中按如下方法使用
<#assign cache=JspTaglibs["/WEB-INF/classes/oscache.tld"] />
<@cache.cache key="xxx" time=20>
${fowUrlaa}
</@cache.cache>
本文介绍如何在Web项目中配置OSCache并结合Freemarker进行缓存操作。首先需要在web.xml中添加相应的taglib配置,并将OSCache的jar包放置于指定目录下。随后,在classes目录下加入配置文件及tld文件。最后,通过Freemarker模板语言实现缓存功能。
2144

被折叠的 条评论
为什么被折叠?



