improve unlinking potential race condition
improve unlinking potential race condition

* fix rare race condition on file cache unlink
* remove unnecessary reset()
* improve code readability using variable

vimeo/psalm,vimeo/psalm