take views into account for template caching, fixes #631