JBoss AS 6 Hibernate L2C, Infinispan RemoteCacheStore
matt_filion Dec 14, 2010 1:22 AMI've been toying with JBoss AS 6 a bit and can get all of my variations of our cache strategies to work except when we need to store the entities in a RemoteCacheStore. For some reason hibernate simply does not call any of the methods on the cache store to load and persist the data.
What I'm basically trying to accomplish is a "Distant" cache for our entities that will be frequently used across all nodes in the cluster. This will reduce the memory footprint of our JBoss instances and reduce the amount of effort spent marshalling/demarshalling inforamtion to and from the database since everything stored in cache is a bit more "native" to the applications environment. This is the cache configuration that I have inside my "infinispan-configs.xml" file in JBoss AS 6 (CR1) but i never see my RemoteCacheStore being utilized.
Has anyone have gone down this route yet or have any knowledge if CacheStores work within the infinispan-configs.xml configurations?
<!-- // infinispan-configs.xml // --> <!-- *************************************** --> <!-- * 100% Remote Cache * --> <!-- *************************************** --> <!-- This configuration passes all cache gets and puts to a remote server and never stored locally within the VM. passivation="false" Must be set to false otherwise the cache loader will not be used for each transaction, it ill only update the cache store when it triggers a "passivation" event at the end of a transaction or during eviction. shared=true Setting this to true avoids multiple cache instances writing the same modification multiple times. If enabled, only the node where the modification originated will write to the cache store. preload=false If true, when the cache starts, data stored in the cache store will be pre-loaded into memory. You can set this attribute to true if we want to establish some sort of "warm" cache that loads from a remote source. --> <!-- *************************************** --> <namedCache name="entity-remote"> <loaders preload="false" shared="true" passivation="false"> <loader class="org.infinispan.loaders.remote.RemoteCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false" purgeSynchronously="false"> <properties> <property name="hotRodClientPropertiesFile" value="${jboss.common.base.url}cluster/infinispan-cache-registry.sar/hotrod-client.properties" /> <property name="useDefaultRemoteCache" value="false" /> <property name="remoteCacheName" value="dist" /> </properties> </loader> </loaders> </namedCache> <!-- // persistence.xml // --> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory"/> <property name="hibernate.cache.infinispan.cachemanager" value="java:CacheManager/entity"/> <!-- To be able to define custom cache for a specific entity or entities collection use the following. When adding new class names to the custom definitions the "name" attribute must start with 'hibernate.cache.infinispan' and end with 'cfg'. Its easy to miss the last part. The middle is the full package and class name of the entity that is currently managed in cache. --> <property name="hibernate.cache.infinispan.com.model.Entity.cfg" value="entity-remote"/> <property name="hibernate.cache.infinispan.com.model.Entity.collection.cfg" value="entity-remote"/> <!-- Default Configurations for Entities that dont have explicit definitions. --> <property name="hibernate.cache.infinispan.entity.cfg" value="entity-remote"/> <property name="hibernate.cache.infinispan.collection.cfg" value="entity-remote"/> <property name="hibernate.cache.infinispan.query.cfg" value="entity-remote"/> <property name="hibernate.cache.infinispan.timestamp.cfg" value="timestamps"/>
</namedCache>