net.sf.ehcache.hibernate
public final class EhCacheProvider extends Object implements CacheProvider
hibernate.cache.provider_class=net.sf.ehcache.hibernate.EhCacheProvider
in the Hibernate configuration
to enable this provider for Hibernate's second level cache.
When configuring multiple ehcache CacheManagers, as you would where you have multiple Hibernate Configurations and
multiple SessionFactories, specify in each Hibernate configuration the ehcache configuration using
the property net.sf.ehcache.configurationResourceName
An example to set an ehcach configuration
called ehcache-2.xml would be net.sf.ehcache.configurationResourceName=/ehcache-2.xml
. If the leading
slash is not there one will be added. The configuration file will be looked for in the root of the classpath.
Updated for ehcache-1.2. Note this provider requires ehcache-1.2.jar. Make sure ehcache-1.1.jar or earlier
is not in the classpath or it will not work.
See http://ehcache.sf.net for documentation on ehcache
Version: $Id: EhCacheProvider.java 191 2006-09-03 22:41:48Z gregluck $
Field Summary | |
---|---|
static String | NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME
The Hibernate system property specifying the location of the ehcache configuration file name.
|
Method Summary | |
---|---|
Cache | buildCache(String name, Properties properties)
Builds a Cache.
|
boolean | isMinimalPutsEnabledByDefault()
Not sure what this is supposed to do.
|
long | nextTimestamp()
Returns the next timestamp. |
void | start(Properties properties)
Callback to perform any necessary initialization of the underlying cache implementation
during SessionFactory construction.
|
void | stop()
Callback to perform any necessary cleanup of the underlying cache implementation
during SessionFactory.close(). |
Parameters: name the name of the cache. Must match a cache configured in ehcache.xml properties not used
Returns: a newly built cache will be built and initialised
Throws: org.hibernate.cache.CacheException inter alia, if a cache of the same name already exists
Returns: false to be safe
Parameters: properties current configuration settings.