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

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

?? cache.java

?? Jive(J道版) Jive(J道版)是在Jive 2.1版本基礎(chǔ)上改編而成
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**
 * $RCSfile: Cache.java,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:51:09 $
 *
 * 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.LinkedList;

/**
 * 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 Cache 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 HashMap cachedObjectsHash;

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

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

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

    /**
     * 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 Cache() {
        // Our primary data structure is a hash map. The default capacity of 11
        // is too small in almost all cases, so we set it bigger.
        cachedObjectsHash = new HashMap(103);

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

    /**
     * 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 Cache(int maxSize) {
        this();
        this.maxSize = maxSize;
    }

    /**
     * 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 Cache(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 Cache(int maxSize, long maxLifetime) {
        this();
        this.maxSize = maxSize;
        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;
        // 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();
    }

    /**
     * Adds a new Cacheable object to the cache. The key must be unique.
     *

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产色产综合产在线视频| 欧美一区三区二区| 亚洲国产精品一区二区www| 欧美无人高清视频在线观看| 午夜视频在线观看一区二区| 精品精品欲导航| 99综合电影在线视频| 亚洲午夜在线电影| 26uuu亚洲综合色| 99精品欧美一区二区三区综合在线| 综合欧美一区二区三区| 欧美日韩国产三级| 国产精品12区| 五月激情丁香一区二区三区| 久久在线观看免费| 欧美亚洲动漫另类| 国产白丝精品91爽爽久久| 夜夜嗨av一区二区三区四季av | 国产日韩在线不卡| 欧美日韩三级在线| 成人精品小蝌蚪| 偷窥少妇高潮呻吟av久久免费| 日本一二三不卡| 91精品国产欧美一区二区18| 成人国产精品免费观看动漫| 日本 国产 欧美色综合| 亚洲老司机在线| 亚洲午夜电影在线| 亚洲精品一区二区三区四区高清| 欧美在线制服丝袜| 暴力调教一区二区三区| 国产一区啦啦啦在线观看| 午夜精品一区二区三区免费视频| 国产女人18水真多18精品一级做 | 成人av集中营| 成人污视频在线观看| 国产传媒久久文化传媒| 美美哒免费高清在线观看视频一区二区| 亚洲综合小说图片| 亚洲欧美日韩在线不卡| 日韩欧美资源站| 成人免费毛片app| 午夜欧美在线一二页| 久久久久久久av麻豆果冻| 免费的成人av| 夜夜亚洲天天久久| 亚洲精品成人天堂一二三| 国产精品久久久久久久久果冻传媒 | 一区二区三区精密机械公司| 亚洲色欲色欲www| 一区二区在线观看视频 | 成人av电影在线| 高清不卡一二三区| 国产91精品露脸国语对白| 成人在线视频一区| aaa亚洲精品一二三区| 91香蕉视频mp4| 欧美亚洲动漫另类| 日韩一区二区麻豆国产| 精品国产乱码久久久久久浪潮| 精品国产在天天线2019| 国产视频一区二区在线| 中文字幕一区二区在线播放| 亚洲综合久久久久| 久久黄色级2电影| 成人午夜电影小说| 99精品视频一区二区三区| 欧美日韩一区二区三区视频| 欧美一级国产精品| 中文字幕亚洲区| 五月激情综合网| 成人毛片视频在线观看| 欧美色爱综合网| 久久影院视频免费| 亚洲一区二区三区国产| 久久精品72免费观看| 96av麻豆蜜桃一区二区| 91精品国产综合久久香蕉的特点 | 26uuu欧美| 亚洲一区二区视频| 九一久久久久久| 成人app软件下载大全免费| 欧美一区二区三区啪啪| 国产精品精品国产色婷婷| 色乱码一区二区三区88| 91精品国产91久久久久久一区二区| 国产欧美精品在线观看| 午夜成人在线视频| www.激情成人| 国产亚洲精品中文字幕| 亚洲成人免费影院| 91视频在线观看| 久久精品视频一区二区三区| 午夜不卡在线视频| 色婷婷av一区| 国产精品久久一级| 国内外成人在线| 成人黄色av电影| 国产午夜精品一区二区三区嫩草 | 国产成人高清在线| 欧美一区二区啪啪| 亚洲一区二区三区在线看| 94色蜜桃网一区二区三区| 欧美国产激情一区二区三区蜜月| 国产精品自拍三区| 国产三区在线成人av| 成人网男人的天堂| 国产精品第13页| 99麻豆久久久国产精品免费 | 日本道免费精品一区二区三区| 亚洲天天做日日做天天谢日日欢 | 制服丝袜激情欧洲亚洲| 亚洲mv在线观看| 日韩一级黄色片| 极品销魂美女一区二区三区| 久久久久国产精品免费免费搜索| 国产在线一区观看| 中文字幕一区av| 欧美在线免费播放| 蜜臀久久久久久久| 国产欧美一区二区三区在线老狼| 国产乱妇无码大片在线观看| 国产欧美日韩卡一| 色婷婷av一区| 欧美影院午夜播放| 婷婷国产在线综合| 精品国产凹凸成av人导航| 成人一级片网址| 亚洲国产精品一区二区尤物区| 欧美一区二区日韩| 成人av电影观看| 日本不卡免费在线视频| 久久精品视频在线看| 欧美日韩在线播放三区| 国产一区二区三区香蕉| 亚洲精品免费播放| 日韩欧美一二三区| 色综合久久综合| 国模娜娜一区二区三区| 亚洲一区二区中文在线| 国产偷国产偷精品高清尤物| 欧美日韩视频在线观看一区二区三区| 国产自产高清不卡| 亚洲成人免费在线观看| 国产精品网曝门| 日韩三级在线观看| 欧美性大战久久久久久久| 国产成人精品午夜视频免费| 天天爽夜夜爽夜夜爽精品视频| 国产精品久久久久7777按摩| ww亚洲ww在线观看国产| 777亚洲妇女| 欧美午夜精品一区二区蜜桃 | 亚洲午夜久久久久中文字幕久| 国产欧美一区二区精品婷婷| 日韩亚洲国产中文字幕欧美| 日本精品视频一区二区三区| 成人精品小蝌蚪| 国产成a人亚洲精| 国产精品一二三四五| 精品一区二区国语对白| 免播放器亚洲一区| 欧美另类z0zxhd电影| 91色在线porny| 91免费在线看| 色婷婷久久久久swag精品| 一本到一区二区三区| 91小宝寻花一区二区三区| 91老司机福利 在线| 一本一道综合狠狠老| 色天使久久综合网天天| 在线精品观看国产| 91久久精品一区二区三区| 日本精品一区二区三区四区的功能| 99久免费精品视频在线观看| 92国产精品观看| 色综合久久久网| 欧美日韩亚洲综合一区二区三区| 一本到一区二区三区| 欧美日韩的一区二区| 欧美大片在线观看| 久久人人97超碰com| 国产精品久久精品日日| 亚洲女爱视频在线| 蜜臀91精品一区二区三区| 狠狠色狠狠色综合| 99精品国产视频| 欧美精品丝袜久久久中文字幕| 欧美mv和日韩mv国产网站| 国产欧美精品一区二区色综合 | 99国产精品99久久久久久| 欧美性色黄大片手机版| 精品国产免费人成在线观看| 欧美日韩午夜在线视频| 欧美二区三区的天堂| 国产精品久久影院| 奇米影视一区二区三区| 95精品视频在线| 欧美sm极限捆绑bd| 亚洲国产成人porn|