@@ -287,6 +287,20 @@ CacheAllocator<CacheTrait>::allocate(PoolId poolId,
287287 ttlSecs == 0 ? 0 : creationTime + ttlSecs);
288288}
289289
290+ template <typename CacheTrait>
291+ ClassId CacheAllocator<CacheTrait>::getAllocClassId(PoolId pid,
292+ typename Item::Key key,
293+ uint32_t size) const {
294+ const auto requiredSize = Item::getRequiredSize (key, size);
295+ return allocator_->getAllocationClassId (pid, requiredSize);
296+ }
297+
298+ template <typename CacheTrait>
299+ uint64_t CacheAllocator<CacheTrait>::getAllocationSize(ClassId cid,
300+ PoolId pid) const {
301+ return getPool (pid).getAllocationClass (cid).getAllocSize ();
302+ }
303+
290304template <typename CacheTrait>
291305typename CacheAllocator<CacheTrait>::WriteHandle
292306CacheAllocator<CacheTrait>::allocateInternal(PoolId pid,
@@ -324,6 +338,7 @@ CacheAllocator<CacheTrait>::allocateInternal(PoolId pid,
324338
325339 handle = acquire (new (memory) Item (key, size, creationTime, expiryTime));
326340 if (handle) {
341+ (*stats_.usedSize )[pid][cid].set (allocator_->getPoolUsedSize (pid));
327342 handle.markNascent ();
328343 (*stats_.fragmentationSize )[pid][cid].add (
329344 util::getFragmentation (*this , *handle));
@@ -2239,7 +2254,7 @@ PoolStats CacheAllocator<CacheTrait>::getPoolStats(PoolId poolId) const {
22392254 (*stats_.fragmentationSize )[poolId][cid].get (), classHits,
22402255 (*stats_.chainedItemEvictions )[poolId][cid].get (),
22412256 (*stats_.regularItemEvictions )[poolId][cid].get (),
2242- container.getStats ()}});
2257+ (*stats_. usedSize )[poolId][cid]. get (), container.getStats ()}});
22432258 totalHits += classHits;
22442259 }
22452260 }
0 commit comments