Package org.apache.commons.collections.map

Examples of org.apache.commons.collections.map.LRUMap


        {
            Integer i = getNumberOfSequentialViewsInSession(context);
            int j = getNumberOfViewsInSession(context);
            if (i != null && i.intValue() > 0)
            {
                _lastWindowKeys = new LRUMap((j / i.intValue()) + 1);
            }
            else
            {
                _lastWindowKeys = new LRUMap(j + 1);
            }
        }
        _lastWindowKeys.put(id, key);
    }
View Full Code Here


        }
        decorationLocator = (TemplateLocator) cm.getComponent("DecorationLocator");

        // initialize thread safe velocity engine cache
        int cacheSize = (int) getLongInitParameter(config, CACHE_SIZE_PARAMETER, DEFAULT_CACHE_SIZE);
        velocityEngineConfigCache = new LRUMap(cacheSize);
        velocityEngineCache = new LRUMap(cacheSize/2);
       
        eventCartridge = new EventCartridge();
        // setup NullSetEventHandler to ignore those pesky "ERROR velocity - RHS of #set statement is null. Context will not be modified."
        eventCartridge.addEventHandler(new NullSetEventHandler()
        {
View Full Code Here

        if (initCache) {
            cacheInitializer.run();
        }
        // limit cache to 1% of maxDoc(), but at least 10.
        this.docNumber2id = Collections.synchronizedMap(
                new LRUMap(Math.max(10, delegatee.maxDoc() / 100)));
        this.termDocsCache = new TermDocsCache(delegatee, FieldNames.PROPERTIES);
    }
View Full Code Here

    private final Map<Path, Result> cache;
    private final Object monitor = new Object();

    @SuppressWarnings("unchecked")
    protected AbstractCompiledPermissions() {
        cache = new LRUMap(1000);
    }
View Full Code Here

     *
     * @param maxSize the maximum size of the cache, -1 for no limit,
     */
    public LRUItemStateCache(int maxSize) {
        // setup cache
        cache = new LRUMap(maxSize, true);
    }
View Full Code Here

        if (size < 0x40) {
            // minimum size is 0x40 * 0x10 = 1024
            size = 0x40;
        }
        for (int i = 0; i < docNumbers.length; i++) {
            docNumbers[i] = new LRUMap(size);
        }
    }
View Full Code Here

     * @param uuid the key.
     * @param reader the index reader from where the document number was read.
     * @param n the document number.
     */
    void put(String uuid, CachingIndexReader reader, int n) {
        LRUMap cacheSegment = docNumbers[getSegmentIndex(uuid.charAt(0))];
        synchronized (cacheSegment) {
            Entry e = (Entry) cacheSegment.get(uuid);
            if (e != null) {
                // existing entry
                // ignore if reader is older than the one in entry
                if (reader.getCreationTick() <= e.reader.getCreationTick()) {
                    if (log.isDebugEnabled()) {
                        log.debug("Ignoring put(). New entry is not from a newer reader. " +
                                "existing: " + e.reader.getCreationTick() +
                                ", new: " + reader.getCreationTick());
                    }
                    e = null;
                }
            } else {
                // entry did not exist
                e = new Entry(reader, n);
            }

            if (e != null) {
                cacheSegment.put(uuid, e);
            }
        }
    }
View Full Code Here

     *
     * @param uuid the key.
     * @return cache entry or <code>null</code>.
     */
    Entry get(String uuid) {
        LRUMap cacheSegment = docNumbers[getSegmentIndex(uuid.charAt(0))];
        Entry entry;
        synchronized (cacheSegment) {
            entry = (Entry) cacheSegment.get(uuid);
        }
        if (log.isInfoEnabled()) {
            accesses++;
            if (entry == null) {
                misses++;
View Full Code Here

            this.cacheKey = key.toString();
            // check cache
            synchronized (cache) {
                Map m = (Map) cache.get(reader);
                if (m == null) {
                    m = new LRUMap(10);
                    cache.put(reader, m);
                }
                resultMap = m;
            }
            synchronized (resultMap) {
View Full Code Here

     *                  registration.
     * @param cacheSize number of mappings this resolver may cache.
     */
    public CachingNamespaceResolver(AbstractNamespaceResolver base, int cacheSize) {
        this.base = base;
        qnameToJCRName = new LRUMap(cacheSize);
        jcrNameToQName = new LRUMap(cacheSize);
        this.base.addListener(this);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.map.LRUMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.