Hibernate

adplus-dvertising
Specification of Second Level Cache
Previous Home Next

Hibernate Session is a transaction-level cache of persistent data.Hibernate has the ability to configure a cluster or JVM-level (SessionFactory-level) cache on a class-by-class and collection-by-collection basis. we can plug in a clustered cache. We need to aware that caches are not having change mode to the persistent store by another application. So it can be called to configured to regularly expire cached data.

We have an another option in Hibernate which cache implementation to use by specifying the name of a class that implements org.hibernate.cache.CacheProvider using the property hibernate.cache.provider_class. Hibernate is combination of bundled with a number of own and plug it in as outlined above. we have to remember EhCache as the default cache provider.

We have given all cache provider in the table:

Cache Provider Class Type Cluster Safe Query Cache Supported
Hashtable (not intended for production use) org.hibernate.cache.HashtableCacheProvider memory Yes
EHCache org.hibernate.cache.EhCacheProvider memory, disk Yes
OSCache org.hibernate.cache.OSCacheProvider memory, disk Yes
SwarmCache org.hibernate.cache.SwarmCacheProvider clustered (ip multicast) yes (clustered invalidation)
JBoss Cache 1.x org.hibernate.cache.TreeCacheProvider clustered (ip multicast transactional yes (replication) yes (clock sync req.)
JBoss Cache 2 org.hibernate.cache.jbc2.JBossCacheRegionFactory clustered (ip multicast) transactional yes (replication or invalidation) yes (clock sync req.)
Previous Home Next