Cache: the number of files opened tracking was done at a too low level
and when switching back on RAM storage we wouldn't check if there was
actually RAM available and it would cause swapping.
This commit addresses this issue.