Example usage for org.apache.commons.jcs.engine.control CompositeCache setAuxCaches

List of usage examples for org.apache.commons.jcs.engine.control CompositeCache setAuxCaches

Introduction

In this page you can find the example usage for org.apache.commons.jcs.engine.control CompositeCache setAuxCaches.

Prototype

public void setAuxCaches(AuxiliaryCache<K, V>[] auxCaches) 

Source Link

Document

This sets the list of auxiliary caches for this region.

Usage

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

@SuppressWarnings("unchecked")
private static <K, V> CacheAccess<K, V> getCacheInner(String cacheName, int maxMemoryObjects,
        int maxDiskObjects, String cachePath) throws IOException {
    CompositeCache<K, V> cc = cacheManager.getCache(cacheName, getCacheAttributes(maxMemoryObjects));

    if (cachePath != null && cacheDirLock != null) {
        IDiskCacheAttributes diskAttributes = getDiskCacheAttributes(maxDiskObjects, cachePath, cacheName);
        try {/*from  w w  w.j a va 2 s .  c  om*/
            if (cc.getAuxCaches().length == 0) {
                cc.setAuxCaches(new AuxiliaryCache[] { DISK_CACHE_FACTORY.createCache(diskAttributes,
                        cacheManager, null, new StandardSerializer()) });
            }
        } catch (IOException e) {
            throw e;
        } catch (Exception e) { // NOPMD
            throw new IOException(e);
        }
    }
    return new CacheAccess<>(cc);
}