NIF file cache v4

I have incorporated the feedback I have received on previous versions of this patch.