<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    JAVA—咖啡館

    ——?dú)g迎訪問rogerfan的博客,常來《JAVA——咖啡館》坐坐,喝杯濃香的咖啡,彼此探討一下JAVA技術(shù),交流工作經(jīng)驗(yàn),分享JAVA帶來的快樂!本網(wǎng)站部分轉(zhuǎn)載文章,如果有版權(quán)問題請(qǐng)與我聯(lián)系。

    BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
      447 Posts :: 145 Stories :: 368 Comments :: 0 Trackbacks
    OSCache安裝與配置
    2007年06月11日 星期一 21:56

    一。簡(jiǎn)介    

          OSCacheOpenSymphony組織提供的一個(gè)J2EE架構(gòu)中Web應(yīng)用層的緩存技術(shù)實(shí)現(xiàn)組件,它的出現(xiàn)解決了我們面臨的問題。 OSCache目前最新的穩(wěn)定版本是2.3.2,本文中的例子都是基于這個(gè)版本的,如果大家運(yùn)行例子的過程中發(fā)生問題,請(qǐng)首先確認(rèn)是否采用了正確的軟件版本。

    二。安裝

    1. 下載、解壓縮OSCache

       請(qǐng)到OSCache的主頁http://www.opensymphony.com/oscache/download.action下載Oscache的最新版本,作者下載的是OSCache的最新穩(wěn)定版本2.3.2

       將下載后的。Zip文件解壓縮到c:\oscache(后面的章節(jié)中將使用%OSCache_Home%來表示這個(gè)目錄)目錄下

    2. 新建立一個(gè)web應(yīng)用

    3. 將主要組件%OSCache_Home%\oscache.jar放入WEB-INF\lib目錄

    4. commons-logging.jarcommons-collections.jar的處理

    • OSCache組件用Jakarta Commons Logging來處理日志信息,所以需要commons-logging.jar的支持,請(qǐng)將%OSCache_Home%\lib\core\commons-logging.jar放入classpath(通常意味著將這個(gè)文件放入WEB-INF\lib目錄)
    • 如果使用JDK1.3,請(qǐng)將%OSCache_Home%\lib\core\commons-collections.jar放入classpath,如果使用JDK1.4或者以上版本,則不需要了

    5. oscache.propertiesoscache.tld放入WEB-INF\class目錄

    • %OSCache_Home%\oscache.properties包含了對(duì)OSCache運(yùn)行特征值的設(shè)置信息
    • %OSCache_Home%\oscache.tld包含了OSCache提供的標(biāo)簽庫的定義內(nèi)容

    6. 修改web.xml文件

    web.xml文件中增加下面的內(nèi)容,增加對(duì)OSCache提供的taglib的支持:

    <taglib>
    <taglib-uri>oscache</taglib-uri>
    <taglib-location>/WEB-INF/classes/ oscache.tld</taglib-location>
    </taglib> 
    三。配置
    Configuration:配置oscache.properties 
    1、cache.memory:
    true 或者 false。默認(rèn)為true
    不使用內(nèi)存緩存而使用硬盤緩存是很愚蠢的事情。
    2、cache.capacity
    緩存object的最大數(shù)量值。默認(rèn)是不限制,cache不會(huì)移走任何緩存內(nèi)容。負(fù)數(shù)被當(dāng)作不限制。
    3、cache.algorithm
    運(yùn)算規(guī)則。為了使用規(guī)則,cache的size必須是指定的。
    如果cache的size不指定的話,法則將不會(huì)限制緩存對(duì)象的大小。
    如果你指定了cache的size,但不指定algorithm,那它會(huì)默認(rèn)使用:com.opensymphony.oscache.base.algorithm.LRUCache
    有下面三種規(guī)則:
    com.opensymphony.oscache.base.algorithm.LRUCache-last in first out,最遲插入的最先調(diào)用。默認(rèn)值。
    com.opensymphony.oscache.base.algorithm.FIFOCache -first int first out。
    com.opensymphony.oscache.base.algorithm.UnlimitedCache -cache中的內(nèi)容將永遠(yuǎn)不會(huì)被丟棄。
    如果cache.capacity不指定值的話,它將被設(shè)為默認(rèn)。
    4、cache.blocking
    是否同步化。true 或者 false。一般設(shè)為true,避免讀取臟數(shù)據(jù)。
    5。cache.unlimited.disk
    指定硬盤緩存是否要作限制。默認(rèn)值為false。false的狀況下,disk cache capacity 將和cache.capacity的值相同。
    6、cache.persistence.class
    指定類是被持久化的類。class必須實(shí)現(xiàn)PersistenceListener接口。
    作為硬盤持久,可以實(shí)現(xiàn)com.opensymphony.oscache.plugins.diskpersistence.HashDiskPersistenceListener接口。
    它把class的toString()輸出的hash值作為文件的名稱。如果你要把文件名易讀(自己設(shè)定),DiskPersistenceListener 的父類也
    能使用,但其可能有非法字符或者過長的名字。
    注意:HashDiskPersistenceListener 和 DiskPersistenceListener 需要設(shè)定硬盤路徑:cache.path
    7、cache.path
    指定硬盤緩存的路徑。目錄如果不存在將被建立。同時(shí)注意oscache應(yīng)該要有權(quán)限寫文件系統(tǒng)。
    cache.path=c:\\myapp\\cache
    or *ix:
    cache.path=/opt/myapp/cache
    8、cache.persistence.overflow.only (NEW! Since 2.1)
    指定是否只有在內(nèi)存不足的情況下才使用硬盤緩存。
    默認(rèn)值false。但推薦是true如果內(nèi)存cache被允許的話。這個(gè)屬性徹底的改變了cache的行為,使得persisted cache
    和memory完全不同。
    9、cache.event.listeners
    用逗號(hào)分離的class名列表。每個(gè)class必須實(shí)現(xiàn)以下接口之一,或者幾個(gè)
    CacheEntryEventListener:接收cache add/update/flush and remove事件
    CacheMapAccessEventListener :接收cache訪問事件。這個(gè)可以讓你跟蹤cache怎么工作。
    默認(rèn)是不配置任何class的。當(dāng)然你可以使用一下的class:
    com.opensymphony.oscache.plugins.clustersupport.BroadcastingCacheEventListener -分布式的監(jiān)聽器。可以廣播到局域網(wǎng)內(nèi)的其他cache實(shí)例。
    com.opensymphony.oscache.extra.CacheEntryEventListenerImpl -一個(gè)簡(jiǎn)單的監(jiān)聽器。在cache的生命周期中記錄count of 所有entry的事件。
    com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl -記錄count of cache map events(cache hits,misses and state hits).
    10、cache.key
    This is the key that will be used by the ServletCacheAdministrator
    (and hence the custom tags) to store the cache object in the application and session scope.
    The default value when this property is not specified is "__oscache_cache". If you want to access this default value in your code, it is available as com.opensymphony.oscache.base.Const.DEFAULT_CACHE_KEY.
    11、cache.use.host.domain.in.key
    If your server is configured with multiple hosts, you may wish to add host name information to automatically generated cache keys. If so, set this property to true. The default value is false.
    12、Additional Properties
    In additon to the above basic options, any other properties that are specified in this file will still be loaded and can be made available to your event handlers. For example, the JavaGroupsBroadcastingListener supports the following additional properties:
    13、cache.cluster.multicast.ip
    The multicast IP to use for this cache cluster. Defaults to 231.12.21.132.
    14、cache.cluster.properties
    Specifies additional configuration options for the clustering. The default setting is

    UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32;\
    mcast_send_buf_size=150000;mcast_recv_buf_size=80000):\
    PING(timeout=2000;num_initial_members=3):\
    MERGE2(min_interval=5000;max_interval=10000):\
    FD_SOCK:VERIFY_SUSPECT(timeout=1500):\
    pbcast.NAKACK(gc_lag=50;retransmit_timeout=300,600,1200,2400,4800;max_xmit_size=8192):\
    UNICAST(timeout=300,600,1200,2400):\
    pbcast.STABLE(desired_avg_gossip=20000):\
    FRAG(frag_size=8096;down_thread=false;up_thread=false):\
    pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true)
    posted on 2009-11-17 14:34 rogerfan 閱讀(179) 評(píng)論(0)  編輯  收藏 所屬分類: 【開源技術(shù)】
    主站蜘蛛池模板: 久久久亚洲AV波多野结衣| 亚洲第一区精品日韩在线播放| 亚洲avav天堂av在线不卡| 成人免费无码H在线观看不卡| 免费日本黄色网址| 三级片免费观看久久| 亚洲精品无码久久久久AV麻豆| 美女裸体无遮挡免费视频网站| 亚洲Av无码乱码在线观看性色| 久青草国产免费观看| 在线亚洲午夜理论AV大片| 日本高清不卡aⅴ免费网站| 久久国产亚洲精品麻豆| 久久久高清日本道免费观看| 亚洲视频在线视频| 日韩免费一区二区三区在线| 亚洲日韩精品无码专区加勒比☆| 国产片免费福利片永久| 成年免费大片黄在线观看com| 亚洲美女又黄又爽在线观看| 国产无遮挡裸体免费视频在线观看 | 精品国产亚洲男女在线线电影| 亚洲精品黄色视频在线观看免费资源| 精品久久香蕉国产线看观看亚洲| 无码成A毛片免费| 亚洲a∨无码一区二区| 亚洲精品麻豆av| 成人黄色免费网址| 国产亚洲福利精品一区二区| 国产亚洲精久久久久久无码77777| 69视频在线是免费观看| 噜噜综合亚洲AV中文无码| 亚洲熟妇无码八AV在线播放| 精品成在人线AV无码免费看| 亚洲AV无码AV吞精久久| 亚洲精品无码午夜福利中文字幕| 一级女人18毛片免费| 永久免费精品影视网站| 亚洲天堂一区二区三区四区| 日韩精品电影一区亚洲| 91免费在线播放|