Fix Cache methods counter.

Added `var` before cycle counters. Renamed `i` counter to `k`.