Example usage for org.apache.commons.jcs.engine CompositeCacheAttributes setDiskUsagePattern

List of usage examples for org.apache.commons.jcs.engine CompositeCacheAttributes setDiskUsagePattern

Introduction

In this page you can find the example usage for org.apache.commons.jcs.engine CompositeCacheAttributes setDiskUsagePattern.

Prototype

@Override
public void setDiskUsagePattern(DiskUsagePattern diskUsagePattern) 

Source Link

Document

By default this is SWAP_ONLY.

Usage

From source file:org.openstreetmap.josm.data.cache.JCSCacheManager.java

private static CompositeCacheAttributes getCacheAttributes(int maxMemoryElements) {
    CompositeCacheAttributes ret = new CompositeCacheAttributes();
    ret.setMaxObjects(maxMemoryElements);
    ret.setDiskUsagePattern(DiskUsagePattern.UPDATE);
    return ret;/*from   w  ww  .j  a v  a  2s  . c  om*/
}

From source file:org.openstreetmap.josm.plugins.openstreetcam.cache.CacheManager.java

private CacheManager() {
    final String pluginLocation = new File(Preferences.main().getPluginsDirectory(),
            GuiConfig.getInstance().getPluginShortName()).getPath();
    final CacheSettings settings = PreferenceManager.getInstance().loadPreferenceSettings().getCacheSettings();

    this.cache = JCSCacheManager.getCache(CACHE_NAME, settings.getMemoryCount(), settings.getDiskCount(),
            pluginLocation + CACHE_LOCATION);
    final CompositeCacheAttributes attr = (CompositeCacheAttributes) this.cache.getCacheAttributes();
    attr.setDiskUsagePattern(DiskUsagePattern.SWAP);
    attr.setMemoryCacheName(MEMORY_MANAGER);
    attr.setUseMemoryShrinker(true);//  www.  j  a va 2 s  . co m
    this.cache.setCacheAttributes(attr);
    this.cache.clear();
}