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).

  • Thanks, yes I know ESI but I felt like I was wasting a lot of caching power by not using full page caches. The only pages that I was able to fully cache, were not even worth it. – ChocoDeveloper Nov 25 '12 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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