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

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

Introduction

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

Prototype

public AuxiliaryCache<K, V>[] getAuxCaches() 

Source Link

Document

Get 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 ww w. ja  v a2  s. co  m*/
            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);
}