List of usage examples for org.apache.commons.jcs.access CacheAccess CacheAccess
public CacheAccess(CompositeCache<K, V> cacheControl)
From source file:org.ebayopensource.scc.cache.JCSCache.java
public void init(AppConfiguration appConfig, Properties cacheProps, ScheduledExecutorService scheduledService) { m_appConfig = appConfig;/* www .j a v a 2 s. c om*/ synchronized (JCSCache.class) { s_ccm = CompositeCacheManager.getUnconfiguredInstance(); s_ccm.configure(cacheProps); s_cache = s_ccm.getCache("default"); s_idc = getIndexDiskCache(s_cache); s_cacheAccess = new CacheAccess<>(s_cache); } m_scheduledService = scheduledService; launchSaveCacheThread(); m_isInitialized = true; }
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 o 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); }