Fix for the cache's file driver - added some protections to race conditions.