Hi Igniters, I need your advice on a task at hand.
Currently cache API size() is a constant time operation, since the number of entries is maintained as a separate counter. However, for MVCC-enabled cache there can be multiple versions of the same entry. In order to calculate the size we need to obtain a MVCC snapshot and then iterate over data pages filtering invisible versions. So, it is impossible to keep the same complexity guarantees. My current implementation internally switches to "full-scan" approach if cache in question is a MVCC-enabled cache. It happens unbeknown to users, which may expect lightning-fast response as before. Perhaps, we might add a new constant to CachePeekMode enumeration that is passed to cache size() to make it explicit? The second concern is that cache size calculation is also included into Cache Metrics API and Visor functionality. Will it be OK for metrics and things alike to keep returning raw unfiltered number of entries? Is there any sense in showing raw unfiltered number of entries which may vary greatly from invokation to invokation with just simple updates running in background? Please share your thoughts. Thanks in advance. -- Sergey