Search in sources :

Example 11 with Configuration

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);
}
Also used : Configuration(net.sf.ehcache.config.Configuration) CacheManager(net.sf.ehcache.CacheManager)

Example 12 with 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);
}
Also used : CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Configuration(net.sf.ehcache.config.Configuration) CacheManager(net.sf.ehcache.CacheManager) CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Before(org.junit.Before)

Example 13 with Configuration

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);
}
Also used : Configuration(net.sf.ehcache.config.Configuration) File(java.io.File)

Aggregations

Configuration (net.sf.ehcache.config.Configuration)13 CacheManager (net.sf.ehcache.CacheManager)9 CacheConfiguration (net.sf.ehcache.config.CacheConfiguration)5 URL (java.net.URL)3 File (java.io.File)2 CacheException (org.hibernate.cache.CacheException)2 Before (org.junit.Before)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 DiskStoreConfiguration (net.sf.ehcache.config.DiskStoreConfiguration)1 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)1 SchemaManager (org.apache.directory.api.ldap.model.schema.SchemaManager)1 NormalizingComparator (org.apache.directory.api.ldap.model.schema.comparators.NormalizingComparator)1 ComparatorRegistry (org.apache.directory.api.ldap.model.schema.registries.ComparatorRegistry)1 SchemaLoader (org.apache.directory.api.ldap.model.schema.registries.SchemaLoader)1 JarLdifSchemaLoader (org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader)1 DefaultSchemaManager (org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)1 CacheService (org.apache.directory.server.core.api.CacheService)1 DnFactory (org.apache.directory.server.core.api.DnFactory)1