use of net.sf.ehcache.config.Configuration in project spring-framework by spring-projects.
the class EhCacheManagerUtils method buildCacheManager.
/**
* Build an EhCache {@link CacheManager} from the default configuration.
* <p>The CacheManager will be configured from "ehcache.xml" in the root of the class path
* (that is, default EhCache initialization - as defined in the EhCache docs - will apply).
* If no configuration file can be found, a fail-safe fallback configuration will be used.
* @param name the desired name of the cache manager
* @return the new EhCache CacheManager
* @throws CacheException in case of configuration parsing failure
*/
public static CacheManager buildCacheManager(String name) throws CacheException {
Configuration configuration = ConfigurationFactory.parseConfiguration();
configuration.setName(name);
return new CacheManager(configuration);
}
use of net.sf.ehcache.config.Configuration in project spring-framework by spring-projects.
the class EhCacheCacheTests method setUp.
@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);
}
use of net.sf.ehcache.config.Configuration in project libresonic by Libresonic.
the class CacheFactory method afterPropertiesSet.
public void afterPropertiesSet() throws Exception {
Configuration configuration = ConfigurationFactory.parseConfiguration();
// Override configuration to make sure cache is stored in Libresonic home dir.
File cacheDir = new File(SettingsService.getLibresonicHome(), "cache");
configuration.getDiskStoreConfiguration().setPath(cacheDir.getPath());
cacheManager = CacheManager.create(configuration);
}
Aggregations