Issue when checking cache, file written as .cache but checked against .php which therefore doesn't exist

Not sure if people use this or not but thought I would pull request anyway.

Most of the changes seem to be just trimming spaces.

Important change is on line #60