Whats the template option in cache_digests gem for?

78 Views Asked by At

I am using the cache_digests gem. I am trying to understand whats the purpose of TEMPLATE option in rake cache_digests:nested_dependencies and cache_digests:dependencies rake tasks.

Could you also tell what the output means? Does the output shows the list of partials which needs will be rendered using cache, so that if there is a mismatch I can change the render partial method accordingly?

1

There are 1 best solutions below

0
On

whats the purpose of TEMPLATE option

Both cache_digests:nested_dependencies and cache_digests:dependencies tasks are provided to help you resolve which partials are rendered inside of your template. To get the list of dependencies you should first decide which page's dependencies you are interested in. So that page (template) is passed to rake task as a TEMPLATE option.

Does the output shows the list of partials which needs will be rendered using cache, so that if there is a mismatch I can change the render partial method accordingly?

The output lists files which are observed by cache-digests for changes. In case the code which that files contain changes, the parent template's cache is going to be expired and new cache is generated.

Sometimes cache-digests can't derive partials' paths correctly, so it's also a reason to watch rake tasks output. Changing problematic render calls or using special comments for explicit dependencies is the way to solve these kind of problems, as described here.