@Bean(name = "goCache") public GoCache createCache() { CacheManager cacheManager = CacheManager.newInstance(new Configuration().name(getClass().getName())); Cache cache = new Cache(cacheConfiguration); cacheManager.addCache(cache); return new GoCache(cache, transactionSynchronizationManager); }
private static Ehcache createCacheIfRequired() { final CacheManager instance = CacheManager.newInstance(new Configuration().name(CachingSubjectDnX509PrincipalExtractor.class.getName())); synchronized (instance) { if (!instance.cacheExists(CACHE_NAME)) { instance.addCache(new Cache(cacheConfiguration())); } return instance.getCache(CACHE_NAME); } }
private static Ehcache createCacheIfRequired(String cacheName) { final CacheManager instance = CacheManager.newInstance(new Configuration().name(cacheName)); synchronized (instance) { if (!instance.cacheExists(cacheName)) { instance.addCache(new net.sf.ehcache.Cache(cacheConfiguration(cacheName))); } return instance.getCache(cacheName); } }
private static Ehcache createCacheIfRequired(String cacheName) { final CacheManager instance = CacheManager.newInstance(new Configuration().name(cacheName)); synchronized (instance) { if (!instance.cacheExists(cacheName)) { instance.addCache(new Cache(cacheConfiguration(cacheName))); } return instance.getCache(cacheName); } }
@Before public void setup() { cacheManager = new CacheManager(new Configuration().name("EhCacheCacheTests") .defaultCache(new CacheConfiguration("default", 100))); nativeCache = new net.sf.ehcache.Cache(new CacheConfiguration(CACHE_NAME, 100)); cacheManager.addCache(nativeCache); cache = new EhCacheCache(nativeCache); }
@Before public void setup() { nativeCacheManager = new CacheManager(new Configuration().name("EhCacheCacheManagerTests") .defaultCache(new CacheConfiguration("default", 100))); addNativeCache(CACHE_NAME); cacheManager = new EhCacheCacheManager(nativeCacheManager); cacheManager.setTransactionAware(false); cacheManager.afterPropertiesSet(); transactionalCacheManager = new EhCacheCacheManager(nativeCacheManager); transactionalCacheManager.setTransactionAware(true); transactionalCacheManager.afterPropertiesSet(); }
@Override public Configuration newConfiguration(@Nonnull final URL baseXmlConfiguration, @Nonnull final ClusterNodeProperties clusterNodeProperties) { notNull(baseXmlConfiguration, "baseXmlConfiguration"); notNull(clusterNodeProperties, "clusterNodeProperties"); FactoryConfiguration peerListenerFactory = buildPeerListenerFactory(clusterNodeProperties); FactoryConfiguration peerProviderFactory = buildPeerProviderFactory(clusterNodeProperties); return ConfigurationFactory.parseConfiguration(baseXmlConfiguration) .name(MANAGER_NAME) .cacheManagerPeerProviderFactory(peerProviderFactory) .cacheManagerPeerListenerFactory(peerListenerFactory); }
private CacheManager createCacheManager(String diskStorePath) { Configuration cacheManagerConfig = new Configuration().dynamicConfig(false) .diskStore( new DiskStoreConfiguration().path(diskStorePath)) .name("default") .updateCheck(false); return CacheManager.create(cacheManagerConfig); }
this.cacheManager = new CacheManager( new Configuration().name( getName() ).diskStore( new DiskStoreConfiguration().path( getDiskStorePath() ) ) );