]
Dan Berindei updated ISPN-11514:
--------------------------------
Status: Open (was: New)
CacheMgmtInterceptor getNumberOfEntries should include expired
entries
----------------------------------------------------------------------
Key: ISPN-11514
URL:
https://issues.redhat.com/browse/ISPN-11514
Project: Infinispan
Issue Type: Feature Request
Components: API, Core
Affects Versions: 11.0.0.Dev03
Reporter: Dan Berindei
Assignee: Dan Berindei
Priority: Major
Fix For: 11.0.0.Final
{{CacheMgmtInterceptor.getNumberOfEntries}} and
{{CacheMgmtInterceptor.getNumberOfEntriesInMemory}} both require an iteration over the
data container and/or stores in order to exclude expired entries.
Since these are statistics, they don't have to be exact, so we can include expired
entries until a read or the expiration reaper removes them from the cache. In fact, I
would argue that it's more correct for
{{CacheMgmtInterceptor.getNumberOfEntriesInMemory}} to include expired entries, because
expired entries still use memory until they are removed.
The most likely reason that the strategy for counting entries was changed with ISPN-7686
is that the {{AdvancedCache}} doesn't have a {{sizeIncludingExpired}} method. Since
it's not possible to obtain the exact size of the cache with passivation enabled
without iterating over the store to eliminate duplicates, I suggest instead to estimate
{{CacheMgmtInterceptor.getNumberOfEntries}} as the number of entries in the data container
+ the number of entries in the store.