<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美元)
    主站蜘蛛池模板: 97无码人妻福利免费公开在线视频 | 99视频在线免费| 永久免费bbbbbb视频| 97se亚洲综合在线| 无码午夜成人1000部免费视频| 亚洲国产成人久久综合一区77| 亚洲无码一区二区三区| 亚洲视频免费在线看| 久久亚洲sm情趣捆绑调教| 黄色网站软件app在线观看免费| 免费一级特黄特色大片在线观看| 亚洲日本天堂在线| 成人免费视频小说| 亚洲色精品三区二区一区| 五月亭亭免费高清在线| 2048亚洲精品国产| 日日狠狠久久偷偷色综合免费 | 三上悠亚在线观看免费| 亚洲AV无码一区东京热| 国产h肉在线视频免费观看| 亚洲影院天堂中文av色| 亚洲av无码国产精品色在线看不卡| 一个人看的www在线免费视频| 亚洲线精品一区二区三区影音先锋 | 亚洲精品无码你懂的| 亚洲国产婷婷综合在线精品 | 日韩免费视频播播| 永久免费无码日韩视频| 久久久无码精品亚洲日韩蜜桃| **一级一级毛片免费观看| 亚洲JIZZJIZZ妇女| 亚洲午夜久久久久久久久久| 91频在线观看免费大全| 日本高清不卡中文字幕免费| 亚洲AV日韩AV永久无码绿巨人| 大地资源二在线观看免费高清| eeuss影院www天堂免费| 亚洲天堂电影在线观看| 亚洲人成色77777在线观看大| 久久国产精品2020免费m3u8| 亚洲国产成人久久精品软件|