Add caching to detail and widget templates