Bust the template digest cache key when details are changed

Since the lookup details will influence which template is resolved, they
need to be included in the cache key -- otherwise two different
templates may erroneously share the same digest value.