A bit of refactoring on cache updates.