org.hibernate.cache
Class EhCacheProvider

java.lang.Object
  extended byorg.hibernate.cache.EhCacheProvider
All Implemented Interfaces:
CacheProvider

public class EhCacheProvider
extends Object
implements CacheProvider

Cache Provider plugin for Hibernate Use hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider in Hibernate 3.x or later Taken from EhCache 0.9 distribution

Author:
Greg Luck, Emmanuel Bernard

Constructor Summary
EhCacheProvider()
           
 
Method Summary
 Cache buildCache(String name, Properties properties)
          Builds a Cache.
 boolean isMinimalPutsEnabledByDefault()
           
 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().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EhCacheProvider

public EhCacheProvider()
Method Detail

buildCache

public Cache buildCache(String name,
                        Properties properties)
                 throws CacheException
Builds a Cache.

Even though this method provides properties, they are not used. Properties for EHCache are specified in the ehcache.xml file. Configuration will be read from ehcache.xml for a cache declaration where the name attribute matches the name parameter in this builder.

Specified by:
buildCache in interface CacheProvider
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:
CacheException - inter alia, if a cache of the same name already exists

nextTimestamp

public long nextTimestamp()
Returns the next timestamp.

Specified by:
nextTimestamp in interface CacheProvider

start

public void start(Properties properties)
           throws CacheException
Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.

Specified by:
start in interface CacheProvider
Parameters:
properties - current configuration settings.
Throws:
CacheException

stop

public void stop()
Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().

Specified by:
stop in interface CacheProvider

isMinimalPutsEnabledByDefault

public boolean isMinimalPutsEnabledByDefault()
Specified by:
isMinimalPutsEnabledByDefault in interface CacheProvider