Example usage for org.apache.commons.collections.map LRUMap LRUMap

List of usage examples for org.apache.commons.collections.map LRUMap LRUMap

Introduction

In this page you can find the example usage for org.apache.commons.collections.map LRUMap LRUMap.

Prototype

public LRUMap(Map map) 

Source Link

Document

Constructor copying elements from another map.

Usage

From source file:com.liferay.portal.ejb.ImageLocalUtil.java

private ImageLocalUtil() {
    _imagePool = new SyncMap(new LRUMap(Image.MAX_SIZE), new WriterPreferenceReadWriteLock());
}

From source file:com.naryx.tagfusion.cfm.tag.ext.cfTHROTTLE.java

protected void defaultParameters(String _tag) throws cfmBadFileException {

    //-- If not initialised, initialise it
    if (throttleHistory == null) {
        throttleHistory = new LRUMap(100);
        startTime = System.currentTimeMillis();
    }//  w  ww .  j  a  va  2  s  .  com

    defaultAttribute("ACTION", "THROTTLE");
    defaultAttribute("HITTHRESHOLD", "5");
    defaultAttribute("HITTIMEPERIOD", "10000");
    defaultAttribute("MINHITTIME", "500");

    parseTagHeader(_tag);

    if (getConstant("ACTION").equalsIgnoreCase("FLUSH")) {
        actionType = ACTION_FLUSH;
    } else if (getConstant("ACTION").equalsIgnoreCase("STATUS")) {
        actionType = ACTION_STATUS;
    } else if (getConstant("ACTION").equalsIgnoreCase("SET")) {
        actionType = ACTION_SET;
    } else {
        actionType = ACTION_THROTTLE;
    }
}

From source file:com.lrodriguez.SoftLimitMRUCache.java

private void init() {
    strongReferenceCache = new LRUMap(strongReferenceCount);
}

From source file:com.dtstack.jlogstash.ua.parser.CachingParser.java

@SuppressWarnings("unchecked")
@Override/* w  w  w  .  j ava2 s .co  m*/
public Device parseDevice(String agentString) {
    if (agentString == null) {
        return null;
    }
    if (cacheDevice == null) {
        cacheDevice = new LRUMap(CACHE_SIZE);
    }
    Device device = cacheDevice.get(agentString);
    if (device != null) {
        return device;
    }
    device = super.parseDevice(agentString);
    cacheDevice.put(agentString, device);
    return device;
}

From source file:de.escidoc.core.aa.business.cache.RequestAttributesCache.java

/**
 * Creates the attribute cache.<br/>The cache is implemented as a synchronized LRUMap (least-recently-used map), so
 * it can only grow to a certain size. The size is taken from the static field <code>usersCacheSize</code> that has
 * to be initialized before calling this method (this is not checked).
 *///from   w  w  w.java 2 s.c om
@SuppressWarnings("unchecked")
private static void createAttributeCache() {

    attributesCache = Collections.synchronizedMap(new LRUMap(usersCacheSize));
}

From source file:com.dtstack.jlogstash.ua.parser.CachingParser.java

@SuppressWarnings("unchecked")
@Override//from  w  ww.  j a  v  a2 s.co m
public OS parseOS(String agentString) {
    if (agentString == null) {
        return null;
    }

    if (cacheOS == null) {
        cacheOS = new LRUMap(CACHE_SIZE);
    }
    OS os = cacheOS.get(agentString);
    if (os != null) {
        return os;
    }
    os = super.parseOS(agentString);
    cacheOS.put(agentString, os);
    return os;
}

From source file:es.caib.seycon.ng.servei.PuntEntradaServiceImpl.java

public PuntEntradaServiceImpl() {
    permisosCache = Collections.synchronizedMap(new LRUMap(50));
}

From source file:de.escidoc.core.aa.business.cache.RequestAttributesCache.java

/**
 * Creates the internal map holding the system objects (attributes) that shall be cached for a request.<br/>
 *
 * @return Returns a synchronized LRU map. The map size is taken from the static field
 *         <code>internalCacheSize</code> that has to be initialized before calling this method (this is not
 *         checked).//from  w w  w  .  j a v  a  2s .  c om
 */
@SuppressWarnings("unchecked")
private static Map<Object, Object> createInternalMap() {

    return Collections.synchronizedMap(new LRUMap(internalCacheSize));
}

From source file:com.frameworkset.platform.cms.driver.i18n.CmsLocaleManager.java

/**
 * Initializes a new CmsLocaleManager, called from the configuration.<p>
 *///from ww w.j a  va2s . c om
public CmsLocaleManager() {

    setDefaultLocale();
    m_availableLocales = new ArrayList();
    m_defaultLocales = new ArrayList();
    m_localeHandler = new CmsDefaultLocaleHandler();
    //        if (CmsLog.INIT.isInfoEnabled()) {
    //            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_I18N_CONFIG_START_0));
    //        }

    LRUMap lruMap = new LRUMap(256);
    m_localeCache = Collections.synchronizedMap(lruMap);
    //        CmsMemoryMonitor monitor = OpenCms.getMemoryMonitor();
    //        if ((monitor != null) && monitor.enabled()) {
    //            // map must be of type "LRUMap" so that memory monitor can acecss all information
    //            monitor.register(this.getClass().getName() + ".m_localeCache", lruMap);
    //        }

    // register this object as event listener
    //        OpenCms.addCmsEventListener(this, new int[] {I_CmsEventListener.EVENT_CLEAR_CACHES});
}

From source file:info.joseluismartin.gtc.AbstractTileCache.java

public void setConfig(CacheConfig config) {
    this.tileMap = Collections.synchronizedMap(new LRUMap(config.getSize()));
    this.name = config.getName();
    this.serverUrl = config.getUrl();
    this.cachePath = config.getDiskCachePath();
    this.path = config.getPath();
    this.age = config.getAge();
}