Fix cache being stale after a part install.

Fixes #4836.