Cache iterator might return unused keys as well. Now unused keys are being removed before cleanup and iteration.