0 Replies Latest reply on Jun 25, 2014 8:26 AM by rayhym

    Stats.getTotalNumberOfEntries() is it returns a wrong number?

    rayhym

      I'm using a TreeCache API and would like to capture the number of node stores in cache.

       

      I've found the way to do that by using

      Stats stats = cacheManager.getCache(cacheInstanceName).getAdvancedCache().getStats();
      

       

      Actually, I have 300 keys store under /cacheName/groupName fqn

       

      The following are all statistics I got

      19:20:03,069 DEBUG InfinispanCacheManager:395 - ****************************************************************
      19:20:03,070 DEBUG InfinispanCacheManager:396 - |     [Statistic] cacheName     : menuCache
      19:20:03,071 DEBUG InfinispanCacheManager:398 - |     [Statistic] getAverageReadTime     : 0
      19:20:03,072 DEBUG InfinispanCacheManager:400 - |     [Statistic] getAverageRemoveTime     : 0
      19:20:03,073 DEBUG InfinispanCacheManager:402 - |     [Statistic] getAverageWriteTime        : 0
      19:20:03,073 DEBUG InfinispanCacheManager:405 - |     [Statistic] getEvictions     : 0     * Number of cache eviction
      19:20:03,074 DEBUG InfinispanCacheManager:408 - |     [Statistic] getHits         : 2422
      19:20:03,075 DEBUG InfinispanCacheManager:409 - |     [Statistic] getMisses     : 0
      19:20:03,076 DEBUG InfinispanCacheManager:411 - |     [Statistic] getRemoveHits     : 0
      19:20:03,077 DEBUG InfinispanCacheManager:413 - |     [Statistic] getRemoveMisses     : 0
      19:20:03,078 DEBUG InfinispanCacheManager:415 - |     [Statistic] getRetrievals     : 2422     * Number of get operations
      19:20:03,078 DEBUG InfinispanCacheManager:418 - |     [Statistic] getStores     : 306     * Number of put operations on the cache
      19:20:03,079 DEBUG InfinispanCacheManager:421 - |     [Statistic] getTimeSinceStart     : 1920     * Number of seconds since cache started
      19:20:03,080 DEBUG InfinispanCacheManager:424 - |     [Statistic] getCurrentNumberOfEntries     : 6    *Number of entries currently in the cache.
      19:20:03,082 DEBUG InfinispanCacheManager:427 - |     [Statistic] getTotalNumberOfEntries     : 306     *Number of entries stored in cache
      19:20:03,083 DEBUG InfinispanCacheManager:430 - ****************************************************************
      

       

      I wonder why I got 306? And after I insert a new key into the cache

       

      The statistics change to

      
      
      18:57:03,059 DEBUG InfinispanCacheManager:396 - |     [Statistic] cacheName     : menuCache
      18:57:03,060 DEBUG InfinispanCacheManager:398 - |     [Statistic] getAverageReadTime     : 0
      18:57:03,061 DEBUG InfinispanCacheManager:400 - |     [Statistic] getAverageRemoveTime     : 0
      18:57:03,061 DEBUG InfinispanCacheManager:402 - |     [Statistic] getAverageWriteTime        : 0
      18:57:03,075 DEBUG InfinispanCacheManager:405 - |     [Statistic] getEvictions     : 0     * Number of cache eviction
      18:57:03,076 DEBUG InfinispanCacheManager:408 - |     [Statistic] getHits         : 2422
      18:57:03,076 DEBUG InfinispanCacheManager:409 - |     [Statistic] getMisses     : 0
      18:57:03,076 DEBUG InfinispanCacheManager:411 - |     [Statistic] getRemoveHits     : 0
      18:57:03,076 DEBUG InfinispanCacheManager:413 - |     [Statistic] getRemoveMisses     : 0
      18:57:03,076 DEBUG InfinispanCacheManager:415 - |     [Statistic] getRetrievals     : 2422     * Number of get operations
      18:57:03,077 DEBUG InfinispanCacheManager:418 - |     [Statistic] getStores     : 307     * Number of put operations on the cache
      18:57:03,078 DEBUG InfinispanCacheManager:421 - |     [Statistic] getTimeSinceStart     : 540     * Number of seconds since cache started
      18:57:03,078 DEBUG InfinispanCacheManager:424 - |     [Statistic] getCurrentNumberOfEntries     : 6    *Number of entries currently in the cache.
      18:57:03,079 DEBUG InfinispanCacheManager:427 - |     [Statistic] getTotalNumberOfEntries     : 307     *Number of entries stored in cache
      

       

      Why the number change corresponding to getStores number?

       

      Please, suggest and thank you in advance.