Only cache template digests if config.cache_template_loading

since ActionView::Resolver.caching is set to the same value as config.cache_template_loading
only cache template digests if config.cache_template_loading is not falsy
fixes issues #10752 and #10791
Merge pull request #11768 from cloudspace/cache_template_loading

Only cache template digests if !config.cache_template_loading