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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? longcache.java

?? Jive論壇2.5版本的源程序
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**
 * $RCSfile: LongCache.java,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:51:12 $
 *
 * New Jive  from Jdon.com.
 *
 * This software is the proprietary information of CoolServlets, Inc.
 * Use is subject to license terms.
 */

package com.jivesoftware.util;

import java.util.*;
import com.jivesoftware.util.LongLinkedList;

/**
 * General purpose cache implementation. It stores objects associated with
 * unique keys in memory for fast access. All objects added to the cache must
 * implement the Cacheable interface, which requires objects to know their
 * size in memory. This restrictions allows the cache to never grow larger
 * than a specified amount.<p>
 *
 * If the cache does grow too large, objects will be removed such that those
 * that are accessed least frequently are removed first. Because expiration
 * happens automatically, the cache makes <b>no</b> gaurantee as to how long
 * an object will remain in cache after it is put in. The cache will return
 * null if the requested object is not found.<p>
 *
 * Optionally, a maximum lifetime for all objects can be specified. In that
 * case, objects will be deleted from cache after that amount of time, even
 * if they are frequently accessed. This feature is useful if objects put in
 * cache represent data that should be periodically refreshed; for example,
 * information from a database.<p>
 *
 * Cache is optimized for fast data access. The getObject() method has 0(n)
 * performance regardless of cache size. The other cache operations also
 * perform quite fast.<p>
 *
 * Cache objects are thread safe.<p>
 *
 * The algorithm for cache is as follows: a HashMap is maintained for fast
 * object lookup. Two linked lists are maintained: one keeps objects in the
 * order they are accessed from cache, the other keeps objects in the order
 * they were originally added to cache. When objects are added to cache, they
 * are first wrapped by a CacheObject which maintains the following pieces
 * of information:<ul>
 *    <li> The size of the object (in bytes).
 *    <li> A pointer to the node in the linked list that maintains accessed
 *         order for the object. Keeping a reference to the node lets us avoid
 *         linear scans of the linked list.
 *    <li> A pointer to the node in the linked list that maintains the age
 *         of the object in cache. Keeping a reference to the node lets us avoid
 *         linear scans of the linked list.</ul>
 *
 * To get an object from cache, a hash lookup is performed to get a reference
 * to the CacheObject that wraps the real object we are looking for.
 * The object is subsequently moved to the front of the accessed linked list
 * and any necessary cache cleanups are performed. Cache deletion and expiration
 * is performed as needed.
 *
 * @see Cacheable
 */
public class LongCache implements Cacheable {

    /**
     * One of the major potential bottlenecks of the cache is performing
     * System.currentTimeMillis() for every cache get operation. Instead,
     * we maintain a global timestamp that gets updated once a second. This
     * means that cache expirations can be no more than one second accurate.
     */
    protected static long currentTime = CacheTimer.currentTime;

    /**
     * Maintains the hash of cached objects. Hashing provides the best
     * performance for fast lookups.
     */
    protected LongHashMap cachedObjectsHash;

    /**
     * Linked list to maintain order that cache objects are accessed
     * in, most used to least used.
     */
    protected LongLinkedList lastAccessedList;

    /**
     * Linked list to maintain time that cache objects were initially added
     * to the cache, most recently added to oldest added.
     */
    protected LongLinkedList ageList;

   /**
    * Maximum size in bytes that the cache can grow to. Default
    * maximum size is 128 K.
    */
    protected int maxSize =  128 * 1024;
    private int maxObjectSize = (int)(maxSize * .90);

    /**
     * Maintains the current size of the cache in bytes.
     */
    protected int size = 0;

    /**
     * Maximum length of time objects can exist in cache before expiring.
     * Default is that objects have no maximum lifetime.
     */
    protected long maxLifetime = -1;

    /**
     * Maintain the number of cache hits and misses. A cache hit occurs every
     * time the get method is called and the cache contains the requested
     * object. A cache miss represents the opposite occurence.<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.
     */
    protected long cacheHits, cacheMisses = 0L;

    /**
     * Create a new cache with default values. Default cache size is 128K with
     * no maximum lifetime.
     */
    public LongCache() {
        // Our primary data structure is a hash map.
        cachedObjectsHash = new LongHashMap();

        lastAccessedList = new LongLinkedList();
        ageList = new LongLinkedList();
    }

    /**
     * Create a new cache and specify the maximum size for the cache in bytes.
     * Items added to the cache will have no maximum lifetime.
     *
     * @param maxSize the maximum size of the cache in bytes.
     */
    public LongCache(int maxSize) {
        this();
        this.maxSize = maxSize;
        this.maxObjectSize = (int)(maxSize * .9);
    }

    /**
     * Create a new cache and specify the maximum lifetime of objects. The
     * time should be specified in milleseconds. The minimum lifetime of any
     * cache object is 1000 milleseconds (1 second). Additionally, cache
     * expirations have a 1000 millesecond resolution, which means that all
     * objects are guaranteed to be expired within 1000 milliseconds of their
     * maximum lifetime.
     *
     * @param maxLifetime the maximum amount of time objects can exist in
     *    cache before being deleted.
     */
    public LongCache(long maxLifetime) {
        this();
        this.maxLifetime = maxLifetime;
    }

    /**
     * Create a new cache and specify the maximum size of for the cache in
     * bytes, and the maximum lifetime of objects.
     *
     * @param maxSize the maximum size of the cache in bytes.
     * @param maxLifetime the maximum amount of time objects can exist in
     *    cache before being deleted.
     */
    public LongCache(int maxSize, long maxLifetime) {
        this();
        this.maxSize = maxSize;
        this.maxObjectSize = (int)(maxSize * .9);
        this.maxLifetime = maxLifetime;
    }

    /**
     * Returns the current size of the cache in bytes.
     *
     * @return the size of the cache in bytes.
     */
    public int getSize() {
        return size;
    }

    /**
     * Returns the maximum size of the cache in bytes. If the cache grows too
     * large, the least frequently used items will automatically be deleted so
     * that the cache size doesn't exceed the maximum.
     *
     * @return the maximum size of the cache in bytes.
     */
    public int getMaxSize() {
        return maxSize;
    }

    /**
     * Sets the maximum size of the cache in bytes. If the cache grows too
     * large, the least frequently used items will automatically be deleted so
     * that the cache size doesn't exceed the maximum.
     *
     * @param maxSize the maximum size of the cache in bytes.
     */
    public void setMaxSize(int maxSize) {
        this.maxSize = maxSize;
        this.maxObjectSize = (int)(maxSize * .9);
        // It's possible that the new max size is smaller than our current cache
        // size. If so, we need to delete infrequently used items.
        cullCache();
    }

    /**
     * Returns the number of objects in the cache.
     *
     * @return the number of objects in the cache.
     */
    public synchronized int getNumElements() {
        return cachedObjectsHash.size();
    }

    /**

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中国av一区二区三区| 午夜电影网一区| 精品亚洲国内自在自线福利| 99国产精品久久久久久久久久 | 一区二区三区美女| 亚洲风情在线资源站| 国产精品欧美精品| 日韩欧美国产一区二区在线播放 | 国产一区二区三区久久悠悠色av| 亚洲美女屁股眼交3| 国产精品午夜免费| 久久久久国产精品厨房| 亚洲图片欧美综合| 亚洲综合免费观看高清在线观看| 国产成人av福利| 欧美成人video| av在线一区二区| 成人av网站在线观看免费| 国产又粗又猛又爽又黄91精品| 免费视频最近日韩| 久久99国产精品久久| 久久精品99国产精品日本| 7777精品伊人久久久大香线蕉| 亚洲女性喷水在线观看一区| 最新国产成人在线观看| 欧美日韩国产精品成人| 天堂一区二区在线| 中文字幕成人在线观看| 欧美私模裸体表演在线观看| 亚洲精品伦理在线| 亚洲一区二区三区四区五区黄| 成人免费一区二区三区视频| 欧美日韩一级片网站| 国产成人精品aa毛片| 成人一级片网址| 色综合天天综合在线视频| 蜜臀精品久久久久久蜜臀| 精品制服美女久久| jizzjizzjizz欧美| 欧美日韩www| 日本一区二区三区久久久久久久久不 | 欧美大片一区二区| 日韩欧美精品三级| 国产日韩在线不卡| 国产精品一区专区| 一区二区免费在线| 日韩欧美亚洲另类制服综合在线| 亚洲视频资源在线| 色欧美乱欧美15图片| 欧美一区二区三区四区五区| 在线播放日韩导航| 国产日韩一级二级三级| 亚洲午夜久久久久久久久电影院 | 国产精品久久久久久妇女6080 | 国产精品系列在线播放| eeuss影院一区二区三区 | 国产女人aaa级久久久级 | 一区二区视频在线| 丝袜美腿成人在线| 成人免费av在线| 777午夜精品免费视频| 精品国内片67194| 亚洲va韩国va欧美va精品| 国产一本一道久久香蕉| 欧美日韩电影一区| 自拍偷拍欧美精品| 国产一区中文字幕| 欧美高清视频在线高清观看mv色露露十八 | 日本一区二区三区电影| 自拍偷拍国产亚洲| 国产一区二区三区最好精华液| 色综合av在线| 中日韩av电影| 激情综合一区二区三区| 欧洲一区在线电影| 中文字幕日韩欧美一区二区三区| 五月激情丁香一区二区三区| 91丨九色丨尤物| 日韩国产欧美在线播放| 日本乱人伦aⅴ精品| 精品美女在线播放| 亚洲国产视频直播| 不卡的av中国片| 国产清纯白嫩初高生在线观看91| 蜜桃视频一区二区三区在线观看| 在线观看视频91| 亚洲一线二线三线视频| 一本色道久久综合亚洲aⅴ蜜桃| 欧美国产精品久久| 国产成人欧美日韩在线电影| 精品第一国产综合精品aⅴ| 蜜臀91精品一区二区三区 | 亚洲乱码国产乱码精品精98午夜| 成人av在线一区二区| 国产欧美视频在线观看| 国产精品一区二区久久不卡| 欧美一级黄色大片| 黄色日韩网站视频| 国产午夜三级一区二区三| 国产精品一二三四五| 欧美国产视频在线| 91天堂素人约啪| 亚洲第四色夜色| 欧美一级黄色大片| 国产九色sp调教91| 日本一区二区久久| 色综合久久久久综合体| 亚洲国产日产av| 91精品国产综合久久精品性色 | 欧美国产成人在线| 色综合久久中文综合久久牛| 亚洲mv大片欧洲mv大片精品| 3d成人h动漫网站入口| 老司机精品视频一区二区三区| 欧美sm极限捆绑bd| 成a人片亚洲日本久久| 亚洲精品成人悠悠色影视| 欧美欧美欧美欧美首页| 九色综合国产一区二区三区| 欧美国产精品一区| 欧美日韩国产乱码电影| 国模一区二区三区白浆| 国产日产欧美一区| 97精品国产露脸对白| 亚洲一区二区在线视频| 欧美最猛性xxxxx直播| 久久精品国产精品亚洲红杏| 欧美国产一区视频在线观看| 欧美日韩不卡在线| 高清国产一区二区| 亚洲高清免费观看高清完整版在线观看 | 亚洲欧美日韩国产综合| 91精品国产麻豆| 国产成人免费视频一区| 国产精品美女久久久久久久久| 精品视频999| av资源网一区| 免费人成网站在线观看欧美高清| 日本一区二区三区dvd视频在线| 欧美日韩黄色一区二区| 从欧美一区二区三区| 日韩中文欧美在线| 亚洲日本护士毛茸茸| 欧美精品一区在线观看| www国产成人| 欧美主播一区二区三区美女| 极品销魂美女一区二区三区| 亚洲色欲色欲www| 日韩一级黄色片| 成人午夜电影久久影院| 奇米影视一区二区三区| 亚洲一区二区在线免费看| 国产精品国产精品国产专区不蜜| 日韩一级欧美一级| 69av一区二区三区| 欧美剧在线免费观看网站 | 日韩一区在线免费观看| 久久女同互慰一区二区三区| 欧美一级二级在线观看| 欧美区视频在线观看| 欧美系列一区二区| 欧美伊人久久久久久午夜久久久久| 东方欧美亚洲色图在线| 粉嫩aⅴ一区二区三区四区| 欧美一级爆毛片| 在线不卡中文字幕播放| 欧美一区二区网站| 精品国产一区二区三区不卡| 久久综合色8888| 中文字幕一区二区三区在线播放| 综合在线观看色| 丝袜诱惑制服诱惑色一区在线观看| 青青草一区二区三区| 国产不卡视频在线播放| 91欧美一区二区| 9191国产精品| 久久久久国产精品麻豆| 有坂深雪av一区二区精品| 日日夜夜一区二区| 国产电影精品久久禁18| 一本大道综合伊人精品热热 | 日韩欧美卡一卡二| 欧美极品美女视频| 亚洲国产欧美另类丝袜| 国产一区亚洲一区| 欧美中文字幕一区| 欧美www视频| 一区二区三区精品| 黄网站免费久久| 欧美日韩一区不卡| 国产精品三级视频| 日本sm残虐另类| 色综合久久中文综合久久牛| 日韩一区二区视频在线观看| 最好看的中文字幕久久| 国模无码大尺度一区二区三区| 色综合色综合色综合| 久久久另类综合| 日韩极品在线观看| 色噜噜偷拍精品综合在线|