Add caching to widgets.

#6043