How does page caching work where master pages and page includes are involved?

Can y’all at skuid please produce a deep dive on page caching?? I have lots of questions about how things work that aren’t covered in the documentation. 

Our scenario:
We have a data-analysis heavy app built with skuid. As we’re rolling out, on-boarding new clients to our multi-tenant environment, things are getting SLOW.
When I’ve completely turned on page caching in the past, things got funky, data didn’t show up, or wrong data showed up. 

So, I’m started trying to incorporate page caching bit by bit, turn it on a page at a time. That doesn’t seem to be possible when there’s a master page. Caching seems to work like a theme, whatever is setup on the master page trickles down. This is obvious on child pages where you can’t select caching, but I can turn on page caching on a non-child page, only it doesn’t seem to change anything when the page loads within the context of the master page. Does caching options on a master page affect all pages loaded within that context, even non-child page includes?

When I do turn it on on the master page, it seems to turn it on everywhere, but not page includes. BUT if I allow all the models to go client-side, things start going wonky. Sharing rules seem to break with clients seeing each others’ data, or data doesn’t load at all. It also doesn’t seem to speed anything up. It seems there are issues with the order in which models load changing, but I don’t really know what’s happening. Is it possible model load order changes when you turn on client-side processing? What happens when a page include processes models server-side within a master page context where models are processed client-side?

Right now I’m testing page caching at the master level, without processing models client side. I know this isn’t recommended since it can present stale data. But this actually seems to make things faster, and so far nothing is breaking. I’m trying to test the stale data issue, but i’m not able to produce any errors there. How and why does page-caching without processing models client side result in stale data? What are some examples?


Hey, Jack!

Just wanted you to know that we’re working on updates to our documentation on the topic of page cacheing. I’ll post suggestions or answers to your questions as we write the new and updated content.

I apologize for the length of this response! I hope you’ll find useful explanations within.

Does caching options on a master page affect all pages loaded within that context, even non-child page includes?

It’s useful to know that hierarchy wins regarding caching behavior.

In the context of master pages, child pages, and page includes, the master page’s caching behavior wins.

Is page caching enabled on a master page? Then child pages will inherit the settings of the master page, as you pointed out. For page includes, the page includes caching settings will be ignored. Page includes are NOT stored in the cache even when the page include is set to load with the main page.

Going back to the idea of hierarchy determining the caching behavior, Lightning Experience aggressively caches pages to improve performance. In Lightning Experience, the Skuid page component will likewise be  cached, even if page caching is disabled for the Skuid page.

In summary, Skuid’s page caching property works best in Salesforce Classic/Visualforce environments.


Is it possible model load order changes when you turn on client-side processing? What happens when a page include processes models server-side within a master page context where models are processed client-side?

Load order does not change, or, at least, it is not supposed to change. The models for the page include will load AFTER the models from the main page; regardless of whether or not the models of the page include are set to process server or client side.

If a model on the page include (set to server-side model processing) had a condition that depends on a model on the main page (set to client-side model processing), then everything should work as expected.

Why? The models for the page include will load after the models for the master and child pages, so server/client side processing on the models of the page include won’t cause errors.

Note: a mixture of client-side and server-side processed models on the same page may cause an error at runtime. For example, a server-side processed model has a condition that uses a value from a client-side processed model on the SAME page; this will trigger an error at runtime.


How and why does page-caching without processing models client side result in stale data? What are some examples?

Page caching may result in stale data because the server-side processed model is stored in the cache along with the page’s HTML.

When you first went to a page with page caching, Skuid collected the XML, user information, and other metadata from the server. Skuid places that data in the cache. If a model is set to query on page load AND server-side processing is on, then the model’s metadata and data are collected from the server at the same time as the initial payload. Skuid can collect page and model data all at once because Skuid runs natively in Salesforce.

If you navigate away from a cached page, then navigate back to it; the page and model data are pulled from the cache instead of the server. If the model is not queried, then the metadata and data are the same as they were when last modified in the cache. If another user made changes to the data on the server, then the cached model data will NOT reflect those changes. That’s what we mean by “stale data”.

“Stale data” shouldn’t happen very often because the metadata and data will be refreshed every time a query runs on that model. Nonetheless, we wanted to make sure that the app builders are aware of the possibility of stale data.


In conclusion, I’m updating our documentation and the in-app help text to reflect these details.

After a careful reading of the help text for the “Process model client-side property”, I must admit I felt like I didn’t understand the property at all. I had to build several test cases to make sure I wasn’t wildly misinterpreting the text!

Pro Tip: a product engineer gave me a simple way to see what will be cached by the page caching feature.

Right click on a page in preview/runtime and click View Page Source.

The page source data is what Skuid caches.

If “Process Model client-side” is NOT checked, then the server-side processed model’s metadata AND data will appear in the page source!


Thanks for asking these questions! I’ll have been and will continue to update our documentation to reflect the research done to understand the interplay between these features and properties.


Thanks Josh! Really helpful.

A couple followup questions/comments, based on a lot of testing on my end as well :slight_smile:

Page includes are NOT stored in the cache even when the page include is set to load with the main page.
So if a master/main page has caching on, the page include will still not be included in the cache? My experience is that page includes do get cached as long as the main page has caching on.


Lightning Experience aggressively caches pages to improve performance
Does Skuid generally run faster in Lightning Experience? If we have completely overriden the Salesforce layout (so we wouldn’t use any Lightning layouts), is there a performance benefit in switching to Lightning Experience?


If the model is not queried, then the metadata and data are the same as they were when last modified in the cache.
Generally I’ve found no consistent problems with stale data - except in the case of deleted records. When I delete a record, say a row in a table, it doesn’t go away from the UI. Even after reloading the page, the deleted record still shows until a do a cache-clearing refresh. This sounds like I can solve that by querying after deletion, would be cool. 

Again, thanks so much for the thorough reply!