Don't use pkg_version when cleaning the cache

Fixes #27245.