0

I needed custom event grouping by category within a Solspace Calendar table. The only way I could find to do this was the following:

Use {exp:stash:append_list} within {exp:calendar:cal} to store the events by category and day.

{exp:stash:append_list name="cal-day-events-{date format="%m"}-{date format="%j"}-{categories show_group="7" limit="1"}{category_id}{/categories}"}

Then use EE's native {exp:channel:calendar} in an embedded template with {exp:stash:get_list} to retrieve the events.

Good news is, it worked!

Since the page is so query intensive I'd like to do some caching to improve the speed of page load.

I tried use EE's native template caching to cache the entire template. It worked on the first load, but subsequent page loads showed no events. It seems that the stash + embedded template approach doesn't work with template caching. Turning it off fixed the issue.

What is a better way to cache this data? Suggestions?

1 Answer 1

1

Have a look at the caching options available with stash. See Mustash for cache breaking rules.

The most basic option here would be to cache the lists when creating them with append list. You might also consider using set_list tags instead of append_list where possible as they will be more efficient (that's my understanding at least)

2
  • Thanks. I'm wrapping the content in exp:stash:cache tags. The first page load is 250 or so queries but then it drops down into the 20's. Does Stash get list always query the DB do you know? Wondering how to get that initial page load query number down.
    – mjr
    Apr 1, 2014 at 20:07
  • Get_list will query the DB unless you do fragment caching on the list when you set it: github.com/croxton/Stash/wiki/Caching#fragment-caching Apr 2, 2014 at 11:31

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.