1 2 Previous Next 17 Replies Latest reply on Nov 28, 2011 6:15 PM by _rob_jboss Go to original post
      • 15. Re: Infinispan not evicting entities from named cache
        _rob_jboss

        Hi Galder,

         

        I have tried changing to CacheConcurrencyStrategy.TRANSACTIONAL with no luck.  I'm now concerned that it works for you and not for me!

         

        I carried out the following two tests:

         

        1) @Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL, region="entity-repeatable")

         

        To use the named cache defined in the infinispan-config.xml

         

        2) @Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL, region="RegionA")

         

        To use the named cache defined in the persistence.xml

         

        Both tests produced the same inifinispan trace:

         

        2011-11-27 15:56:37,603 TRACE [org.infinispan.interceptors.InvocationContextInterceptor] (WorkerThread#0[192.168.199.2:1650]) Invoked with command PutKeyValueCommand{key=com.acme.IncidentTest#1, value=CacheEntry(com.acme.IncidentTest)[RTA,Accident,London,EDF], putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1} and InvocationContext [NonTxInvocationContext{flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ]}]

         

        2011-11-27 16:16:21,472 TRACE [org.infinispan.interceptors.InvocationContextInterceptor] (WorkerThread#0[192.168.199.2:1760]) Invoked with command PutKeyValueCommand{key=com.acme.IncidentTest#1, value=CacheEntry(com.acme.IncidentTest)[RTA,Accident,London,EDF], putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1} and InvocationContext [NonTxInvocationContext{flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ]}]

         

        I have attached my test project (NetBeans) for your review.  I have also attached the logs from both tests, infinispan-config.xml and the sql script for the IncidentTest table.

         

        I'm hoping that you get the same results as I currently am!

         

        All the best.

        • 16. Re: Infinispan not evicting entities from named cache
          galder.zamarreno

          Thx for attaching those files. I'm checking them but in the mean time, can you try changing this?

           

          In the RegionA case, change all hibernate.cache.infinispan.RegionA.* properties to: hibernate.cache.infinispan.Project6.RegionA.*

          1 of 1 people found this helpful
          • 17. Re: Infinispan not evicting entities from named cache
            _rob_jboss

            That works, excellent!  It is also independant from the CacheConcurrencyStrategy setting.

             

            With this in mind I tried the following, but none worked:

             

            1) Added the cache region prefix to the region attribute of the cache annotation:

             

            @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region="Project6.entity-repeatable")

             

            <namedCache name="entity-repeatable">

            <clustering mode="invalidation">

              <stateRetrieval fetchInMemoryState="false" timeout="20000"/>

              <sync replTimeout="20000"/>

            </clustering>

            <locking isolationLevel="REPEATABLE_READ" concurrencyLevel="1000"

                 lockAcquisitionTimeout="15000" useLockStriping="false"/>

            <eviction wakeUpInterval="1000" maxEntries="10" strategy="FIFO"/>

            <expiration maxIdle="-1" lifespan="10000"/>

            <lazyDeserialization enabled="true"/>

            </namedCache>

             

            2) Added the cache region prefix to the named cache in infinispan-config.xml

             

            @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region="entity-repeatable")

             

            <namedCache name="Project6.entity-repeatable">

            <clustering mode="invalidation">

              <stateRetrieval fetchInMemoryState="false" timeout="20000"/>

              <sync replTimeout="20000"/>

            </clustering>

            <locking isolationLevel="REPEATABLE_READ" concurrencyLevel="1000"

                 lockAcquisitionTimeout="15000" useLockStriping="false"/>

            <eviction wakeUpInterval="1000" maxEntries="10" strategy="FIFO"/>

            <expiration maxIdle="-1" lifespan="10000"/>

            <lazyDeserialization enabled="true"/>

            </namedCache>

             

            3) Added the cache region prefix to both the named cache and the region attribute of the cache annotation:

             

            @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region="Project6.entity-repeatable")

             

            <namedCache name="Project6.entity-repeatable">

            <clustering mode="invalidation">

              <stateRetrieval fetchInMemoryState="false" timeout="20000"/>

              <sync replTimeout="20000"/>

            </clustering>

            <locking isolationLevel="REPEATABLE_READ" concurrencyLevel="1000"

                 lockAcquisitionTimeout="15000" useLockStriping="false"/>

            <eviction wakeUpInterval="1000" maxEntries="10" strategy="FIFO"/>

            <expiration maxIdle="-1" lifespan="10000"/>

            <lazyDeserialization enabled="true"/>

            </namedCache>

             

            Outcome:

             

            This allows me to programically set the cache regions for entities and to continue using the infinispan-config for the query cache regions.  It would be nice though to defined the entities cache regions within infinispan-config so that they can be changed (if required) without recompiling the project.  If you have any thoughts on this, please let me know.

             

            Thanks very much for your help.

             

            Rob.

            1 2 Previous Next