1 Reply Latest reply: May 17, 2012 3:45 AM by Galder Zamarreño RSS

JdbmCacheStore.size() is not "supported", how to get the number of elements of the cache

dex chen Novice

I used JdbmCacheStore for one of my cache. In my code, I call cache.size() to get the number of elements in the cache. But, I saw the following WARN messages in the log:

WARN  org.infinispan.loaders.jdbm.JdbmCacheStore[571] - size() should never be called; except for tests

 

 

Look inside the code of JdbmCachStore, the size() is not really implemented.

 

What is the correct way to get the size of the cache?

  • 1. Re: JdbmCacheStore.size() is not "supported", how to get the number of elements of the cache
    Galder Zamarreño Master

    Hmmm, I'm not sure that cache.size() call and that warning are related, because cache.size() is computed based only on the elements residing in memory.

     

    That warning could come from loading all, or partially the elements in the JDBM store and size being called by that. Dunno where that would happen in your env though.

     

    So, at first glance, you shouldn't worry about it, but if you can find out, with a breakpoint or something, how that warning appears, we might be able to help further to see if it's something to worry about or not.