<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一宅男色影视| 四虎永久在线精品免费一区二区| 又爽又高潮的BB视频免费看| 美女视频黄.免费网址| 免费一级做a爰片久久毛片潮喷| 国产精品亚洲色图| 亚洲AV日韩精品一区二区三区| 污污视频网站免费观看| 久久亚洲精品无码播放| a级毛片免费完整视频| 亚洲AV成人片色在线观看| 久视频精品免费观看99| 亚洲人片在线观看天堂无码| 国产免费人视频在线观看免费| 男女交性无遮挡免费视频| 国产综合精品久久亚洲| 久久99毛片免费观看不卡| 亚洲福利一区二区精品秒拍| 黄瓜视频高清在线看免费下载| 亚洲成aⅴ人片久青草影院按摩| 亚洲国产精品嫩草影院久久 | 国产V亚洲V天堂A无码| www.免费在线观看| 久久水蜜桃亚洲AV无码精品| 亚洲国产中文字幕在线观看| 久久精品成人免费观看| 亚洲私人无码综合久久网| 亚洲视频在线免费| 亚洲电影免费在线观看| 亚洲欧美日韩国产精品一区| 亚洲日韩中文无码久久| 99热在线精品免费全部my| 成人特级毛片69免费观看| 亚洲综合久久综合激情久久| 我要看免费的毛片| 国产在线精品免费aaa片| 亚洲精品无码专区| 亚洲AV无码成人网站久久精品大 | 国产大片线上免费看|