Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

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

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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