Template caching