2 Replies Latest reply on Jun 13, 2007 2:15 PM by genman

    Cache region size

    nenorbot

      Hello,

      Is there any way I can determine the number of objects cached in a region in TreeCache?

      Thanks :)

        • 1. Re: Cache region size
          genman


          Regions don't necessarily track this information, though I suppose they could. You could write a function to calculate the size, using a combination of CacheSPI.peek() (2.0) or TreeCache.peek() ... Recursively iterate over children of the Nodes returned by peek().

          • 2. Re: Cache region size
            genman

            What I mean by "not necessarily" is that the eviction algorithms do track size. So, your region would have to have some sort of eviction policy. In which case, you can get at the size by doing a

            Region.getEvictionPolicy().getEvictionAlgorithm().getEvictionQueue().getNumberOfNodes()