I want to have fully cacheable pages in my websites, but one cannot do that if they contain user-specific data, like the userbar or things in the UI that can change depending on the permissions the user has.
So I was thinking whether it was possible to pull everything that is user-specific via ajax, and update the UI accordingly.
But I’m worried that this might be annoying for the user, and also it might be difficult to develop.
What do you think? Is there a pattern or something I can follow to deal with this?
Yes, pulling dynamic data via AJAX is a totally viable solution. Not sure if that pattern has a name or not, but I’ve done it before. Another option that is supported by some edge cache platforms (both hosted and otherwise) is ESI which works like SSI, but allows you set a custom TTL for page fragments. One thing to consider is whether you will have content that is unique per visitor (like a welcome message) versus having a handful of permutations which might be managed with slightly different URLs (like a query param or hashbang).
1