use of org.ehcache.jsr107.EhcacheCachingProvider in project cas by apereo.
the class Ehcache3TicketRegistryConfiguration method ehcache3TicketCacheManager.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "ehcache3TicketCacheManager")
public CacheManager ehcache3TicketCacheManager(final ConfigurableApplicationContext applicationContext, @Qualifier("ehcache3CacheManagerConfiguration") final ServiceCreationConfiguration ehcache3CacheManagerConfiguration, final CasConfigurationProperties casProperties) {
return BeanSupplier.of(CacheManager.class).when(CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache3();
val ehcacheProvider = (EhcacheCachingProvider) Caching.getCachingProvider(EhcacheCachingProvider.class.getName());
val statisticsAllEnabled = ehcacheProperties.isEnableStatistics() ? ConfigurationElementState.ENABLED : ConfigurationElementState.DISABLED;
val managementEnabled = ehcacheProperties.isEnableManagement() ? ConfigurationElementState.ENABLED : ConfigurationElementState.DISABLED;
val jsr107Config = new Jsr107Configuration(null, new HashMap<>(), false, managementEnabled, statisticsAllEnabled);
val configuration = new DefaultConfiguration(ehcacheProvider.getDefaultClassLoader(), ehcache3CacheManagerConfiguration, jsr107Config);
return ehcacheProvider.getCacheManager(ehcacheProvider.getDefaultURI(), configuration);
}).otherwiseProxy().get();
}
use of org.ehcache.jsr107.EhcacheCachingProvider in project oncotree by cBioPortal.
the class OncoTreeAppConfig method cachingProvider.
@Bean
public CachingProvider cachingProvider() throws Exception {
logger.info("cachingProvider() called");
CachingProvider cachingProvider = new EhcacheCachingProvider();
return cachingProvider;
}
use of org.ehcache.jsr107.EhcacheCachingProvider in project tutorials by jhkim105.
the class CacheConfig method hibernatePropertiesCustomizer.
@Bean
public HibernatePropertiesCustomizer hibernatePropertiesCustomizer() {
CachingProvider cachingProvider = new EhcacheCachingProvider();
CacheManager cacheManager = cachingProvider.getCacheManager();
MutableConfiguration<String, Object> configuration = new MutableConfiguration<>();
configuration.setStoreByValue(false).setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 1)));
cacheManager.createCache("user", configuration);
return hibernateProperties -> hibernateProperties.put(ConfigSettings.CACHE_MANAGER, cacheManager);
}
use of org.ehcache.jsr107.EhcacheCachingProvider in project solarnetwork-central by SolarNetwork.
the class BufferingDelegatingCacheTests method createCacheManager.
public static CacheManager createCacheManager() {
try {
File path = Files.createTempDirectory("net.solarnetwork.central.common.test").toFile();
path.deleteOnExit();
EhcacheCachingProvider cachingProvider = (EhcacheCachingProvider) Caching.getCachingProvider("org.ehcache.jsr107.EhcacheCachingProvider");
DefaultConfiguration configuration = new DefaultConfiguration(cachingProvider.getDefaultClassLoader(), new DefaultPersistenceConfiguration(path));
return cachingProvider.getCacheManager(cachingProvider.getDefaultURI(), configuration);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.ehcache.jsr107.EhcacheCachingProvider in project solarnetwork-central by SolarNetwork.
the class UserNodeEventTaskProcessorJobTests method createCacheManager.
public static CacheManager createCacheManager() {
try {
File path = Files.createTempDirectory("net.solarnetwork.central.user.event.dao.jobs.test").toFile();
path.deleteOnExit();
EhcacheCachingProvider cachingProvider = (EhcacheCachingProvider) Caching.getCachingProvider("org.ehcache.jsr107.EhcacheCachingProvider");
DefaultConfiguration configuration = new DefaultConfiguration(cachingProvider.getDefaultClassLoader(), new DefaultPersistenceConfiguration(path));
return cachingProvider.getCacheManager(cachingProvider.getDefaultURI(), configuration);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Aggregations