缓存引擎--OSCache

1.安装过程

取得的文件 [oscache-2.*.*-full.zip] 按照如下格式存放:

\WEB-INF\lib\oscache.jar

\WEB-INF\classes\oscache.properties

\WEB-INF\classes\oscache.tld

 

web.xml按如下配置:

<taglib>

  <taglib-uri>oscache</taglib-uri>

  <taglib-location>/WEB-INF/classes/oscache.tld</taglib-location>

</taglib>

 

2.oscache.properties 文件配置

cache.memory:true->保存到内存 false->保存到硬盘
cache.capacity:缓存个数,默认无限制

cache.algorithm:缓存算法

    com.opensymphony.oscache.base.algorithm.LRUCache 最近使用

    com.opensymphony.oscache.base.algorithm.FIFOCache 先进先出

    com.opensymphony.oscache.base.algorithm.UnlimitedCache 无限缓存

 

3.缓存过滤器  CacheFilter  

<filter>

  <filter-name>CacheFilter</filter-name>

  <filter-class>com.opensymphony.oscache.web.filter.CacheFilter</filter-class>

  <init-param>

    <param-name>time</param-name>

    <param-value>60</param-value>

  </init-param>

  <init-param>

    <param-name>scope</param-name>

    <param-value>session</param-value>

  </init-param>

</filter>

 

<filter-mapping>

  <filter-name>CacheFilter</filter-name>

  <url-pattern>*.jsp</url-pattern>

</filter-mapping>

 



 


 

你可能感兴趣的:(算法,filter,引擎)