亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? longcache.java

?? Jive論壇2.5版本的源程序
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
     * Adds a new Cacheable object to the cache. The key must be unique.
     *
     * @param key a unique key for the object being put into cache.
     * @param object the Cacheable object to put into cache.
     */
    public synchronized void add(long key, Cacheable object) {
        // Delete an old entry if it exists.
        remove(key);

        int objectSize = object.getSize();
        // If the object is bigger than the entire cache, simply don't add it.
        if (objectSize > maxObjectSize) {
            return;
        }
        size += objectSize;
        LongCacheObject cacheObject = new LongCacheObject(object, objectSize);
        cachedObjectsHash.put(key, cacheObject);
        // Make an entry into the cache order list.
        LongLinkedListNode lastAccessedNode = lastAccessedList.addFirst(key);
        // Store the cache order list entry so that we can get back to it
        // during later lookups.
        cacheObject.lastAccessedListNode = lastAccessedNode;
        // Add the object to the age list
        LongLinkedListNode ageNode = ageList.addFirst(key);
        // We make an explicit call to currentTimeMillis() so that total accuracy
        // of lifetime calculations is better than one second.
        ageNode.timestamp = System.currentTimeMillis();
        cacheObject.ageListNode = ageNode;

        // If cache is too full, remove least used cache entries until it is
        // not too full.
        if (size >= maxSize) {
            cullCache();
        }
    }

    /**
     * Gets an object from cache. This method will return null under two
     * conditions:<ul>
     *    <li>The object referenced by the key was never added to cache.
     *    <li>The object referenced by the key has expired from cache.</ul>
     *
     * @param key the unique key of the object to get.
     * @return the Cacheable object corresponding to unique key.
     */
    public synchronized Cacheable get(long key) {
        // First, clear all entries that have been in cache longer than the
        // maximum defined age.
        deleteExpiredEntries();

        LongCacheObject cacheObject = (LongCacheObject)cachedObjectsHash.get(key);
        if (cacheObject == null) {
            // The object didn't exist in cache, so increment cache misses.
            cacheMisses++;
            return null;
        }

        // The object exists in cache, so increment cache hits.
        cacheHits++;

        // Remove the object from it's current place in the cache order list,
        // and re-insert it at the front of the list.
        cacheObject.lastAccessedListNode.remove();
        lastAccessedList.addFirst(cacheObject.lastAccessedListNode);

        return cacheObject.object;
    }

    /**
     * Removes an object from cache.
     *
     * @param key the unique key of the object to remove.
     */
    public synchronized void remove(long key) {
        LongCacheObject cacheObject = (LongCacheObject)cachedObjectsHash.get(key);
        // If the object is not in cache, stop trying to remove it.
        if (cacheObject == null) {
            return;
        }
        // remove from the hash map
        cachedObjectsHash.removeKey(key);
        // remove from the cache order list
        cacheObject.lastAccessedListNode.remove();
        cacheObject.ageListNode.remove();
        // remove references to linked list nodes
        cacheObject.ageListNode = null;
        cacheObject.lastAccessedListNode = null;
        // removed the object, so subtract its size from the total.
        size -= cacheObject.size;
    }

    /**
     * Clears the cache of all objects. The size of the cache is reset to 0.
     */
    public synchronized void clear() {
        long [] keys = cachedObjectsHash.keys();
        for (int i=0; i<keys.length; i++) {
            remove(keys[i]);
        }

        // Now, reset all containers.
        cachedObjectsHash.clear();
        // cachedObjectsHash = new HashMap(103);
        lastAccessedList.clear();
        lastAccessedList = new LongLinkedList();
        ageList.clear();
        ageList = new LongLinkedList();

        size = 0;
        cacheHits = 0;
        cacheMisses = 0;
    }

    /**
     * Returns an array of the keys contained in the cache.
     *
     * @return an array of the keys present in the cache.
     */
    public long [] keys() {
        return cachedObjectsHash.keys();
    }

    /**
     * Returns an array of the values contained in the cache.
     *
     * @return a array of the cache entries.
     */
    public Object [] values() {
        Object [] cacheObjects = cachedObjectsHash.values();
        Object [] values = new Object[cacheObjects.length];
        for (int i=0; i<cacheObjects.length; i++) {
            values[i] = ((LongCacheObject)cacheObjects[i]).object;
        }
        return values;
    }

    /**
     * Returns the number of cache hits. A cache hit occurs every
     * time the get method is called and the cache contains the requested
     * object.<p>
     *
     * Keeping track of cache hits and misses lets one measure how efficient
     * the cache is; the higher the percentage of hits, the more efficient.
     *
     * @return the number of cache hits.
     */
    public long getCacheHits() {
        return cacheHits;
    }

    /**
     * Returns the number of cache misses. A cache miss occurs every
     * time the get method is called and the cache does not contain the
     * requested object.<p>
     *
     * Keeping track of cache hits and misses lets one measure how efficient
     * the cache is; the higher the percentage of hits, the more efficient.
     *
     * @return the number of cache hits.
     */
    public long getCacheMisses() {
        return cacheMisses;
    }

    /**
     * Clears all entries out of cache where the entries are older than the
     * maximum defined age.
     */
    private final void deleteExpiredEntries() {
        // Check if expiration is turned on.
        if (maxLifetime <= 0) {
            return;
        }

        // Remove all old entries. To do this, we remove objects from the end
        // of the linked list until they are no longer too old. We get to avoid
        // any hash lookups or looking at any more objects than is strictly
        // neccessary.
        LongLinkedListNode node = ageList.getLast();
        // If there are no entries in the age list, return.
        if (node == null) {
            return;
        }

        // Determine the expireTime, which is the moment in time that elements
        // should expire from cache. Then, we can do an easy to check to see
        // if the expire time is greater than the expire time.
        long expireTime = currentTime - maxLifetime;

        while(expireTime > node.timestamp) {
            // Remove the object
            remove(node.key);

            // Get the next node.
            node = ageList.getLast();
            // If there are no more entries in the age list, return.
            if (node == null) {
                return;
            }
        }
    }

    /**
     * Removes objects from cache if the cache is too full. "Too full" is
     * defined as within 3% of the maximum cache size. Whenever the cache is
     * is too big, the least frequently used elements are deleted until the
     * cache is at least 10% empty.
     */
    private final void cullCache() {
        // First, delete any old entries to see how much memory that frees.
        deleteExpiredEntries();
        final int desiredSize = maxObjectSize;
        while (size > desiredSize) {
            // Get the key and invoke the remove method on it.
            remove(lastAccessedList.getLast().key);
        }
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩你懂的| 欧美日韩久久久一区| 亚洲国产一区二区视频| 欧美一级视频精品观看| 色婷婷综合五月| 久久精品国产77777蜜臀| 亚洲欧美成人一区二区三区| 欧美白人最猛性xxxxx69交| 色8久久人人97超碰香蕉987| 国产乱淫av一区二区三区| 午夜精品久久久久久久99水蜜桃| 欧美激情一区二区三区四区| 91精品视频网| 欧美日韩一本到| 91在线国产观看| 高清beeg欧美| 久久99精品久久久久久国产越南| 天天综合色天天综合| 亚洲乱码一区二区三区在线观看| 国产婷婷精品av在线| 日韩欧美中文字幕精品| 欧美午夜精品理论片a级按摩| 成人国产一区二区三区精品| 国产一区高清在线| 麻豆久久一区二区| 奇米一区二区三区| 人人爽香蕉精品| 日韩av电影天堂| 亚洲va天堂va国产va久| 亚洲一区二区三区精品在线| 亚洲免费伊人电影| 综合激情成人伊人| 亚洲欧美另类久久久精品2019| 中文字幕一区在线观看视频| 国产精品久久影院| 国产精品情趣视频| 国产精品你懂的在线| 中文字幕免费在线观看视频一区| 久久久久九九视频| 国产亚洲综合av| 欧美激情在线免费观看| 中文字幕中文乱码欧美一区二区| 国产亚洲欧美在线| 国产视频911| 国产精品毛片无遮挡高清| 国产精品色在线观看| 国产精品久久福利| 成人综合日日夜夜| 国产v综合v亚洲欧| 成年人网站91| 色哟哟一区二区| 欧美亚洲自拍偷拍| 777精品伊人久久久久大香线蕉| 日韩一卡二卡三卡四卡| 精品国产乱码久久久久久牛牛| 久久综合丝袜日本网| 欧美韩日一区二区三区四区| 国产精品久久看| 亚洲一级二级三级在线免费观看| 亚洲第一av色| 国产麻豆一精品一av一免费| 成人av免费在线观看| 色狠狠综合天天综合综合| 欧美日韩成人一区| 久久精品一级爱片| 亚洲激情男女视频| 秋霞影院一区二区| 国产成人在线色| 91在线观看污| 欧美一区二区网站| 国产亚洲一区二区三区在线观看| 亚洲欧美色图小说| 日本人妖一区二区| 成人av资源站| 欧美人动与zoxxxx乱| www欧美成人18+| 亚洲欧美偷拍卡通变态| 乱一区二区av| 91尤物视频在线观看| 日韩欧美高清在线| 亚洲欧美日韩久久| 另类成人小视频在线| 91老师片黄在线观看| 日韩精品一区二区三区在线| 中文在线一区二区| 日本不卡在线视频| www.色精品| 精品久久久久一区二区国产| 日韩理论片在线| 国产一区二区女| 欧美亚洲动漫制服丝袜| 国产婷婷色一区二区三区四区| 天天综合色天天| 91社区在线播放| 久久综合av免费| 日韩精品亚洲专区| 91丝袜美女网| 国产婷婷一区二区| 免费成人美女在线观看.| 91美女在线观看| 国产欧美日韩另类视频免费观看| 日韩高清不卡在线| 91高清在线观看| 亚洲欧美综合网| 国内成人精品2018免费看| 欧美日本在线观看| 亚洲免费观看高清| 国产91在线|亚洲| 日韩免费视频一区二区| 亚洲高清三级视频| 色久综合一二码| 中文字幕一区二区三区在线播放| 精品一区二区三区日韩| 精品视频在线免费观看| 亚洲图片激情小说| 成人午夜电影网站| 国产日韩欧美高清| 国产一区91精品张津瑜| 日韩欧美亚洲另类制服综合在线 | 国产亚洲短视频| 免费久久精品视频| 欧美日韩国产电影| 亚洲综合无码一区二区| 91啪亚洲精品| 综合激情成人伊人| 91色|porny| 亚洲人一二三区| 色婷婷综合久久| 最新国产精品久久精品| 国产色一区二区| 国产成人在线电影| 久久久久久黄色| 国产xxx精品视频大全| 中文字幕欧美激情| 99精品国产91久久久久久| 国产精品系列在线| 成人福利在线看| 亚洲图片你懂的| 色呦呦国产精品| 亚洲国产日韩av| 欧美精品v国产精品v日韩精品| 香蕉乱码成人久久天堂爱免费| 欧美丰满高潮xxxx喷水动漫| 午夜视频在线观看一区| 91精品免费观看| 精品一区二区av| 国产欧美一区二区在线观看| 国产91综合一区在线观看| **欧美大码日韩| 欧美亚洲尤物久久| 蜜桃传媒麻豆第一区在线观看| 精品国产露脸精彩对白| 国产999精品久久久久久| 亚洲色图另类专区| 欧美年轻男男videosbes| 免费三级欧美电影| 国产欧美日本一区视频| 色视频成人在线观看免| 午夜免费欧美电影| 亚洲精品在线电影| www.av亚洲| 午夜久久久久久久久| 精品不卡在线视频| 91小视频免费观看| 日韩精品五月天| 国产亚洲精品福利| 色视频成人在线观看免| 国产99久久久久久免费看农村| 日韩国产成人精品| 国产日韩欧美麻豆| 在线影院国内精品| 久久99国内精品| 中文字幕一区三区| 91精品国产综合久久精品图片 | 99久久精品国产一区| 亚洲综合无码一区二区| 精品国产免费一区二区三区香蕉 | 欧美一区二区私人影院日本| 国产成人免费视频| 亚洲成人激情自拍| 久久久蜜臀国产一区二区| 色综合久久中文综合久久牛| 日日噜噜夜夜狠狠视频欧美人 | 色综合久久中文字幕| 日韩精品色哟哟| 国产精品久久久久婷婷| 欧美精品99久久久**| 成人黄色网址在线观看| 丝袜亚洲精品中文字幕一区| 国产精品欧美极品| 欧美tickling挠脚心丨vk| 91丨九色丨国产丨porny| 久久国产欧美日韩精品| 亚洲毛片av在线| 中文字幕+乱码+中文字幕一区| 欧美一卡2卡3卡4卡| 91福利社在线观看| 高清成人免费视频| 久久99久国产精品黄毛片色诱| 亚洲精品视频在线观看免费|