We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cabd034 commit fa5fa64Copy full SHA for fa5fa64
cachelib/experimental/objcache2/ObjectCacheSizeController-inl.h
@@ -21,8 +21,11 @@ namespace cachelib {
21
namespace objcache2 {
22
template <typename AllocatorT>
23
void ObjectCacheSizeController<AllocatorT>::work() {
24
- auto totalObjSize = objCache_.getTotalObjectSize();
25
auto currentNumEntries = objCache_.getNumEntries();
+ if (currentNumEntries == 0) {
26
+ return;
27
+ }
28
+ auto totalObjSize = objCache_.getTotalObjectSize();
29
// Do the calculation only when total object size or total object number
30
// achieves the threshold. This is to avoid unreliable calculation of average
31
// object size when the cache is new and only has a few objects.
0 commit comments