Use details to invalidate template resolver cache.

Currently if details change (e.g. format) then the cache will serve up the
wrong template (e.g. html instead of xml). This seems like undesired
behaviour to me(I ran into it on rspec/rspec-rails#864), so pass through
the details to the cache and allow differing details to have differing cached
templates.