def cached(key, path_info, details, locals)
      name, prefix, partial = path_info

      if key
        @cache.cache(key, name, prefix, partial, locals) do
          yield
        end
      else
        yield
      end
    end
def cached(key, path_info, details, locals)
      name, prefix, partial = path_info

      if key
        @cache.cache(key, name, prefix, partial, locals) do
          yield
        end
      else
        yield
      end
    end
Handles templates caching. If a key is given and caching is on
 always check the cache before hitting the resolver. Otherwise,
 it always hits the resolver but if the key is present, check if the
 resolver is fresher before returning it.