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

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

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

    asdtiang的博客 感謝blogjava提供的博客交流平臺
    boolean isKeyInCache(java.lang.Object key)
    An inexpensive check to see if the key exists in the cache.

     

    Parameters:
    key - the key to check for
    Returns:
    true if an Element matching the key is found in the cache. No assertions are made about the state of the Element.

    這個方法是Ehcache的方法,它只判斷key是否存在,并不判斷這個緩存元素過期沒有,所以當元素加入緩存時key就一直存在,所以就算元素過期,只要key被緩存過一次,這個方法就返回true,
    即緩存元素被移除的話,key還存在。


    程序就不能用這個方法來判斷緩存中是否存在這個某個緩存元素。
     得用如下方法:

    getQuiet

    Element getQuiet(java.lang.Object key)
    throws java.lang.IllegalStateException,
    CacheException
    Gets an element from the cache, without updating Element statistics. Cache statistics are also not updated.

     

    Parameters:
    key - a serializable value
    Returns:
    the element, or null, if it does not exist.
    Throws:
    java.lang.IllegalStateException - if the cache is not Status.STATUS_ALIVE
    CacheException
    Since:
    1.2
    See Also:
    isExpired(net.sf.ehcache.Element)

    isExpired

    boolean isExpired(Element element)
    throws java.lang.IllegalStateException,
    java.lang.NullPointerException
    Checks whether this cache element has expired.

    The element is expired if:

    1. the idle time is non-zero and has elapsed, unless the cache is eternal; or
    2. the time to live is non-zero and has elapsed, unless the cache is eternal; or
    3. the value of the element is null.

     

    Parameters:
    element - the element to check
    Returns:
    true if it has expired
    Throws:
    java.lang.IllegalStateException - if the cache is not Status.STATUS_ALIVE
    java.lang.NullPointerException - if the element is null


    示例代碼:
    Element element=cache.getQuiet(key);
            log.info(
    "element:"+element);
            
    if(element!=null){
                log.info(
    "cache.isExpired(element):"+cache.isExpired(element));
                log.info(
    "cacheName:" + cacheName + " key:" + key + " isExist:true");
                
    return true;
            }

            
    else{
                log.info(
    "cacheName:" + cacheName + " key:" + key + " isExist:false");
                
    return false;
            }





    天蒼蒼,野茫茫,風吹草底見牛羊

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


    網站導航:
     

    posts - 80, comments - 24, trackbacks - 0, articles - 32

    Copyright © asdtiang

    asdtiang的博客 PaidMailz
    點擊廣告網賺A(每天4個廣告,每個0.0025美元,一個搜索廣告0.03美元)
    主站蜘蛛池模板: 国产免费观看网站| 好男人视频社区精品免费| 亚洲福利视频一区二区| 免费一区二区无码视频在线播放 | 色吊丝永久在线观看最新免费| 亚洲毛片基地日韩毛片基地| 久久精品免费一区二区| 亚洲国产成人九九综合| 天天操夜夜操免费视频| 香港特级三A毛片免费观看| 亚洲综合色视频在线观看| 中文永久免费观看网站| 亚洲国产精品一区二区久久| 91久久精品国产免费一区| 亚洲一区欧洲一区| 四虎成人精品在永久免费| h片在线播放免费高清| 久久亚洲国产精品五月天| 亚洲一区二区三区免费在线观看 | 色偷偷女男人的天堂亚洲网| 免费理论片51人人看电影| 特a级免费高清黄色片| 亚洲VA中文字幕无码一二三区| 三年片在线观看免费观看大全一| 久久精品国产亚洲AV嫖农村妇女| 精品久久久久国产免费| 黄色免费在线观看网址| 久久久无码精品亚洲日韩蜜桃 | 91视频免费网站| 亚洲大香伊人蕉在人依线| 免费一级特黄特色大片在线 | 亚洲成人午夜在线| 成人黄18免费视频| 成人免费av一区二区三区| 亚洲a级片在线观看| 久久久久久A亚洲欧洲AV冫| 91免费福利精品国产| 免费观看四虎精品成人| 日本久久久久亚洲中字幕| 亚洲av无码乱码在线观看野外| 一级毛片免费播放|