2 Replies Latest reply on Jul 22, 2008 5:41 AM by Manik Surtani

    cache not flushed as often as expected

    Richard Yang Apprentice

      I am running jboss 4.2 and hibernate with jboss treecache (deployed as mbean) as hibernate cache provider. I have the following default region evict policy defined in the treecache-service.xml :
      org.jboss.cache.eviction.LRUPolicy

      <!--0 means no limit -->
      0
      1800
      1800


      In my code I save my query cache into a region called "/myregion". However, I don't have region "/myregion" configured. I thought if myregion is not defined in treecache-service.xml, it falls back to _default_ region. So I expected that every 30 mins my cache is flushed. However, I found that the cache is flushed every 3 or 4 hours, not 30 mins as specified in the _default_ region.

      Do I have to define myregion? Doesn't treecache uses default cache policy if it cannot fine myregion?

      Thanks.

        • 1. Re: cache not flushed as often as expected
          Richard Yang Apprentice

          Sorry the xml quoto was missing. It is

          <region name="/_default_">
           <!--0 means no limit -->
           <attribute name="maxNodes">0</attribute>
           <attribute name="timeToLiveSeconds">1800</attribute>
           <attribute name="maxAgeSeconds">1800</attribute>
           </region>


          "yangju" wrote:
          I am running jboss 4.2 and hibernate with jboss treecache (deployed as mbean) as hibernate cache provider. I have the following default region evict policy defined in the treecache-service.xml :
          <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
          <region name="/_default_">
          <!--0 means no limit -->
          <attribute name="maxNodes">0</attribute>
          <attribute name="timeToLiveSeconds">1800</attribute>
          <attribute name="maxAgeSeconds">1800</attribute>
          </region>

          In my code I save my query cache into a region called "/myregion". However, I don't have region "/myregion" configured. I thought if myregion is not defined in treecache-service.xml, it falls back to _default_ region. So I expected that every 30 mins my cache is flushed. However, I found that the cache is flushed every 3 or 4 hours, not 30 mins as specified in the _default_ region.

          Do I have to define myregion? Doesn't treecache uses default cache policy if it cannot fine myregion?

          Thanks.


          <region name="/_default_">
          <!--0 means no limit -->
          <attribute name="maxNodes">0</attribute>
          <attribute name="timeToLiveSeconds">1800</attribute>
          <attribute name="maxAgeSeconds">1800</attribute>
          </region>


          • 2. Re: cache not flushed as often as expected
            Manik Surtani Master

            No, it should fall back t the default region. If you switch on your logging, you should see the eviction thread kick in and you can monitor what it does.