<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美元)
    主站蜘蛛池模板: 久久精品国产亚洲av水果派| 免费人成在线观看播放国产| 亚洲中文字幕成人在线| 高潮毛片无遮挡高清免费视频| 性感美女视频在线观看免费精品| 亚洲人xxx日本人18| 最近的中文字幕大全免费版| 亚洲AV无码无限在线观看不卡| 搡女人真爽免费视频大全| 伊人久久亚洲综合影院首页| 无码视频免费一区二三区| 亚洲AV永久无码精品网站在线观看| 在线免费观看韩国a视频| 黄页网站在线视频免费| 亚洲&#228;v永久无码精品天堂久久| 国产精品久久亚洲一区二区| 午夜亚洲国产成人不卡在线 | 亚洲人成77777在线播放网站不卡| 国产成人精品免费视频大| 亚洲日本va在线观看| 国产免费牲交视频| 国产午夜无码片免费| 精品日韩亚洲AV无码| 成人片黄网站A毛片免费| 久久久久亚洲精品无码网址色欲| 亚洲国产综合精品中文字幕 | 亚洲电影免费观看| 成人黄18免费视频| 一级人做人爰a全过程免费视频 | a级男女仿爱免费视频| 亚洲精品国产成人| 日本不卡在线观看免费v| 国产日韩在线视频免费播放| 亚洲最大的视频网站| 日韩在线视频免费看| 成人免费一区二区三区| 亚洲人成小说网站色| 亚洲午夜精品一级在线播放放 | 18pao国产成视频永久免费| 亚洲人成网站18禁止| 三上悠亚亚洲一区高清|