3 ms·
Typically you serve up that content separately from the static content. We use it where it doesn't cache for logged in users but is on a rolling cache otherwise
by theg2 13y ago
Typically you serve up that content separately from the static content. We use it where it doesn't cache for logged in users but is on a rolling cache otherwise. Page updates invalidate the cache immediately as well.
On a dynamic site with user content, you're going to be using some sort of object caching depending on your framework and language of choice, Varnish is great for news sites and things of that nature though.
- byoung2 13y agoYou can also cache some content on a page, even for logged-in users, and add in the dynamic parts using ESI. For example an ecommerce site could have a category page cached, and have one section at the top that says "Hello, John Doe" generated dynamically and added in using ESI. https://www.varnish-cache.org/trac/wiki/ESIfeatures https://www.varnish-cache.org/trac/wiki/ESIfeatures
- troels 13y agoOr pull the dynamic parts in via ajax - I find that works quite well.
- kiallmacinnes 13y agoI'm not disagreeing.. but lots of people either dislike relying on JS, or would prefer to have the initial page load be a complete page. If your AJAX is pulling down HTML fragments rather than JSON, then Varnish's ESI gives you the best of both worlds, allowing varnish the gather and assemble the initial page from the same endpoints your JS would hit.