LRUCache::GetFoundSize always returns zero
|Assignee:||Jan Dolinár||% Done:|
I don't really understand the code in LRUCache, especially the reasons behind flag and Item::flag. But I strongly suspect there is some bug in the code in LRUCache<T, K>::Get that takes care about incrementing the foundsize counter. Right now it probably only counts each retrieval once and even after ClearCounters was called. That doesn't really match the description.
As I already said, I don't really understand the logic that lead to using the flag variables :-) Nevertheless, I attach a patch eliminates them and that also seems to make the LRUCache behave as documented. Of course, if you can think of better solution, I won't mind :)
#1 Updated by Miroslav Fidler almost 7 years ago
- Status changed from New to Ready for QA
- Assignee changed from Miroslav Fidler to Jan Dolinár
I agree that documentation is misleading. Anyway, the intent is to know how much data in the cache was reused (since last ClearCounters) and how much data was added. This is a good thing to know to estimate the cache growth.
I will try to reword documentation.