2 Replies Latest reply on Nov 14, 2016 8:52 AM by vdzhuvinov

    Multiple Local Cache's with File Stores

    adam.mccormick

      Hi,

       

      I am configuring Infinispan 7.2.4 for use in ModeShape. I have a local cache for the repository configured with file-store persistence. When I add another local-cache with file-store persistence (for use as ModeShape's binary storage) I can see that the second cache's .dat files are created twice. Once in the default cache's file-store location I specify in the repository cache and once for the other cache.  I have the following configuration:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="urn:infinispan:config:7.2 http://www.infinispan.org/schemas/infinispan-config-7.2.xsd"
         xmlns="urn:infinispan:config:7.2">
        <cache-container default-cache="repository" statistics="false" >
             <jmx duplicate-domains="true"/>
             <local-cache name="repository" statistics="false">
                  <transaction mode="NON_XA" locking="OPTIMISTIC"/>
                  <locking acquire-timeout="2000" />
                  <persistence passivation="false">
                       <file-store fetch-state="false" shared="false" preload="false" purge="false" path="${application.home}/data"/>
                  </persistence>
             </local-cache>
             <local-cache name="binary" statistics="false">
                  <transaction mode="NON_XA" locking="OPTIMISTIC"/>
                  <locking acquire-timeout="2000" />
                  <persistence passivation="false">
                       <file-store fetch-state="false" shared="false" preload="false" purge="false" path="${application.home}/binary"/>
                  </persistence>
             </local-cache>
        </cache-container>
      </infinispan>

       

      When the application starts I can see the following on my file system:

      {application.home}/data/repository.dat

      {application.home}/data/binary.dat

      {application.home}/binary/binary.dat

       

      I assume I am doing something wrong in the configuration but I don't really know what.

       

      Any help would be great.

       

      Thanks!

      -Adam

        • 1. Re: Multiple Local Cache's with File Stores
          nadirx

          Default cache inheritance strikes back !
          Please create an empty unused cache for the default cache and leave the other two as they are.

           

          <?xml version="1.0" encoding="UTF-8"?>
          <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="urn:infinispan:config:7.2 http://www.infinispan.org/schemas/infinispan-config-7.2.xsd"
             xmlns="urn:infinispan:config:7.2">
            <cache-container default-cache="unused" statistics="false" >
                 <jmx duplicate-domains="true"/>
                 <local-cache name="unused" statistics="false" />
                 <local-cache name="repository" statistics="false">
                      <transaction mode="NON_XA" locking="OPTIMISTIC"/>
                      <locking acquire-timeout="2000" />
                      <persistence passivation="false">
                           <file-store fetch-state="false" shared="false" preload="false" purge="false" path="${application.home}/data"/>
                      </persistence>
                 </local-cache>
                 <local-cache name="binary" statistics="false">
                      <transaction mode="NON_XA" locking="OPTIMISTIC"/>
                      <locking acquire-timeout="2000" />
                      <persistence passivation="false">
                           <file-store fetch-state="false" shared="false" preload="false" purge="false" path="${application.home}/binary"/>
                      </persistence>
                 </local-cache>
            </cache-container>
          </infinispan>
          
          • 2. Re: Multiple Local Cache's with File Stores
            vdzhuvinov

            This is a nice trick / using default-cache="unused" /