Jhonney的專欄

             ----人見人愛
          隨筆 - 49, 文章 - 1, 評論 - 23, 引用 - 0
          數據加載中……

          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的最新版本

           可以使用內存、硬盤空間、同時使用內存和硬盤或者提供自己的其他資源(需要自己提供適配器)作為緩存區。

          • 使用內存作為緩存區將可以提供更好的性能
          • 使用硬盤作為緩存區可以在服務器重起后迅速恢復緩存內容
          • 同時使用內存和硬盤作為緩存區則可以減少對內存的占用

          posted on 2007-06-25 05:09 Jhonney 閱讀(2751) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 裕民县| 突泉县| 平南县| 延庆县| 曲松县| 平度市| 永泰县| 霍城县| 安平县| 凤阳县| 来安县| 应城市| 阳东县| 秭归县| 汤阴县| 柳州市| 太康县| 蕲春县| 汝州市| 齐河县| 齐齐哈尔市| 石门县| 灵山县| 西乌珠穆沁旗| 咸丰县| 法库县| 新乐市| 孝昌县| 敦化市| 漾濞| 离岛区| 红原县| 舟山市| 罗定市| 九江市| 文登市| 韩城市| 张北县| 正镶白旗| 吴川市| 江永县|