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

Fix for the caching system's file driver. Under high load multiple requests can be creating / deleting file. This commit adds additional checks to avoid race conditions and silence PHP warnings. This fix is similar to #1403 , but this commit does not implement deleting files randomly.