0.9.x cache invalidation fix

Backport cache invalidation fix (#487) to 0.9.x
Possible fix for #929 ?