cache: add back target entry on rename
(cherry picked from commit 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d)