MDL-38565 cache: improve stats gathering