Rebuild the cache before refreshing the UI.