I’m trying to improve the speed of my rendered pages, which in some cases are taking 15+ seconds on initial load. I think I’m not using the cache enough (ie calling too many things uncached). If anyone could either point me at a URI or help out that would be great:
1. Call a snippet uncached if:
- You want to return dynamic content - eg form error checking, retrieving etc
- You want to return random content (same as above)
- You need to check user permissions
- You are retrieving content not in modx cache - eg RSS feeds or a custom table(?)
- You are using an output filter (?)
ie Formit and Login would normally be called uncached. getResources will vary, depending on what you’re using it for.
2. Call a snippet cached if:
- The cache will be rebuilt anyway to reflect the change you want to see - eg navigation, on-page TVs - will be rebuilt on resource save. Other examples of this are MetaX
- ie basically in most cases
ie it appears that if you update a resource title/other field, or update a TV - etc on save by default it will rebuild the cache for that page and any cache that the page is involved in (such as nav bars). So Wayfinder, tagLister, MetaX, Googlesitemap would normally be cached.
3. Call a chunk - or preferably the placeholder within a chunk (although presumably that affects the whole chunk, and not just that placeholder) - uncached if you are using the chunk on multiple pages and you have a placeholder that you want to change from page to page.
4. Output filters - presumably cached except for things that might change outside of the page refresh (eg date output filters, userinfo output filters).
Does that look correct to you? (I still need to work on the initial speed, as the cache is 4x faster, which is great - but it still takes 9s to render the page.)