oscache 与 ehcache的对比

 

一.ehcache主要是对数据库访问的缓存,相同的查询语句只需查询一次数据库,

  从而提高了查询的速度,使用spring的AOP可以很容易实现这一功能.

  http://ehcache.sourceforge.net/

  ehcache.xml

     <cache name="sampleCache1"

        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="300"
        timeToLiveSeconds="600"
        overflowToDisk="true"
        />
org.springframework.cache.ehcache.EhCacheManagerFactoryBean
org.springframework.cache.ehcache.EhCacheFactoryBean
org.springframework.aop.support.RegexpMethodPointcutAdvisor
 

二.  oscache 主要是对页面的缓存,可以整页或者指定网页某一部分缓存,同时

  指定他的过期时间,这样在此时间段里面访问的数据都是一样的

1.log4j-1.2.8.jar,oscache-2.3.2.jar,commons-logging.jar,jgroups-all.jar

2.拷贝cach\etc\下的oscache.tld,oscache.properties 到WEB-INF\classes

3.web.xml

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

   <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>    

 http://www.opensymphony.com/oscache/download.html下载Oscache的最新版本

 java进阶网 http://www.javady.com/index.php/category/big_data

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值