2 Replies Latest reply on Oct 9, 2009 3:18 AM by manik

    Eviction and cache store

      Hi,

      I'd just like to clarify what happens with eviction and cachestores.

      Expiration will remove items from the cache and cachestore.
      Eviction will only remove items from memory but will leave the item in the cachestore? Is that correct?

      How do we set the time the item remains in memory before being removed? (but still in the cachestore).

      Thanks
      David

        • 1. Re: Eviction and cache store

          Here is my xml file:

          <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.0">
           <global>
           <transport clusterName="demoCluster"/>
           </global>
          
           <default>
           <clustering mode="replication">
           </clustering>
          
           <eviction wakeUpInterval="100" maxEntries="5000" strategy="FIFO"/>
          
           <locking
           isolationLevel="REPEATABLE_READ"
           lockAcquisitionTimeout="2000"
           writeSkewCheck="false"
           concurrencyLevel="500" useLockStriping="false"/>
           <loaders>
           <loader class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore" fetchPersistentState="false"
           ignoreModifications="false" purgeOnStartup="false">
           <properties>
           <property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE"/>
           <property name="idColumnName" value="ID_COLUMN"/>
           <property name="dataColumnName" value="DATA_COLUMN"/>
           <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
           <property name="timestampColumnType" value="BIGINT"/>
           <property name="connectionFactoryClass"
           value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
           <property name="connectionUrl" value="jdbc:h2:~/testing;DB_CLOSE_DELAY=-1"/>
           <property name="userName" value="sa"/>
           <property name="driverClass" value="org.h2.Driver"/>
           <property name="idColumnType" value="VARCHAR(255)"/>
           <property name="dataColumnType" value="BINARY"/>
          <!-- <property name="dropTableOnExit" value="true"/>-->
           <property name="createTableOnStart" value="true"/>
           </properties>
           </loader>
           </loaders>
          
           </default>
          
          </infinispan>
          


          I was trying to do a test where I check the size of the cache after reading a value, pause for a bit to allow the item to be evicted and recheck the size of the cache. At the moment that isn't doing as I thought it might.

          • 2. Re: Eviction and cache store
            manik

             

            "davepleydell" wrote:

            Expiration will remove items from the cache and cachestore.

            Yes.

            "davepleydell" wrote:

            Eviction will only remove items from memory but will leave the item in the cachestore? Is that correct?

            Yes.

            "davepleydell" wrote:

            How do we set the time the item remains in memory before being removed? (but still in the cachestore).

            Eviction is not time based, but rather it is size based. You would set up a max number of entries and once this is reached entries get evicted from memory.