7

Wondering what the best method is for caching with Stash and or CE Cache when using Template Partials. Some questions come to mind:

  • Is it best to use CE Cache in the wrapper (this seems easiest?)
  • Should we be using CE Cache in each of the partials instead of the wrapper?
  • Should we be using Stash caching in the viewModels first?

Again, hope to see some best practices in regards to working with ExpressionEngine template partials approach for caching with Stash and or CE Cache.

2 Answers 2

3

@Jae - You can use rules in the same way with CE Cache. The parameter tag= allows to you add tags and then in the cp, control when they are refreshed - hope that helps.

In terms caching and partials, I use CE to cache the wrapper with the parameter global="yes" and then escape the stash:get. Then within the stash:set cache the page.

I also set the caching timeout in the config to 0 so it's there for good, then with the above mentioned tagging, any update to the entry/channel results in cache being reset but not the global wrapper.

It works well for us, I'd be interested to hear any other approaches. This gives us flexibility and some great caching. Also, on non-dynamic sites (no user logged in stuff), CE has static caching - which is like lightening.

Is this what you are doing? Anything better out there?

1
  • would you mind adding some example code for this so we can get a little more of a visual?
    – Natetronn
    Commented Jan 20, 2013 at 20:43
0

Perhaps a bit off-topic, but for partials, we tend to go with Solspace Template Morsels. CE Cache is great to wrap multiple blocks of code, but the fact that TM comes with both time-based and edit-based rules is a real plus (i.e., update cache when an entry from channel xyz is edited/created).

3
  • This doesn't seem to answer the question, yet it is the accepted answer? These kinds of best practices questions tend not to have a canonical answer, so it may be more appropriate to not select one.
    – Ian
    Commented Jan 20, 2013 at 20:14
  • Agreed though, it was the only response (until now) so, felt it deserved points for effort. I've opened it up again for now.
    – Natetronn
    Commented Jan 20, 2013 at 20:37
  • 2
    @Jae CE Cache does have time and edit-based rules. It can break on comments, tags, edits, deletes, and more. See Cache Breaking and Tags. Commented Feb 5, 2013 at 0:56

Your Answer

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

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