Remove unused local vars in Cache
As reported by phpstorm. This should fix them.
fixed permission change.
Merge pull request #5589