1

So we have our navigation cached within stash to help rendering time. And as you can imagine, the navigation is present on every page.

The problem is, for some reason this is creating a cache for every page... For example, there's an [index]:navigation, as well as an about-us:navigation and a contact-us:navigation. There's also a partials:navigation that gets created, but I think this is just stash saving the template to the database.

As our navigation takes a good amount of time to render, this become a problem when we need to apply the cache breaking rules as now every single page load needs to re-render the navigation and cache it to it's own specific cache.

The tag I'm using for the cache on the navigation is {exp:stash:cache name="navigation"}. I have the default scope set to site in my configuration file, and when I look in Mustash it says the scope is site. For the Label in Mustash though, it says @URI:navigation and I'm not really sure why that is happening? I believe that's the problem here.

How do I get my navigation cache fragment to be a global one, and not one generated for every single page?

1 Answer 1

2

{exp:stash:cache} creates a cached variable with the URI as the context. That means each URI at which the host template is viewed will generate a unique instance of the variable. This tag is therefore generally used for full page caching, or for URI-specific fragments of template code.

You should use {exp:stash:set} with the site scope to create a single global fragment.

Examples here: https://github.com/croxton/Stash/wiki/Caching

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.