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

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

Introduction

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

Prototype

@Override
public void setUseMemoryShrinker(boolean useShrinker) 

Source Link

Document

Whether the memory cache should perform background memory shrinkage.

Usage

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);
    this.cache.setCacheAttributes(attr);
    this.cache.clear();
}