Hi there, I saw the mention and can address how AdPlugg handles it.
AdPlugg allows your pages to be served out of cache by default. With AdPlugg, all of the ads are retrieved and rendered asynchronously in the browser using JavaScript. This makes it so that you can easily serve your pages out of cache while still applying logic and rotation to your ads.
Take a look at any large site: these days all their ads are being served using JavaScript and an ad server – caching and site performance are a couple of the big reasons why.
I haven’t seen ESI used for ads before but it should be possible. Serving the ads via JavaScript or using an iFrame are a lot more common solutions and would likely be a lot easier to implement.
Yep, I knew about that and listed adPlugg as one of those interesting solutions I may look into. I’m just wondering how it would work with ESI and if that technology would essentially allow WordPress itself to imitate an ad server by allowing the TTL to be set independently.
Ok, I’ve come back to answer my own question after researching LiteSpeed ESI. The answer is, YES ESI can be used to do this. And, even better, it’s super easy to do it!
SOLUTION
ESI has a shortcode method for identifying something as being enabled for ESI! You can read about that here:
Turning WordPress Shortcodes into ESI Blocks
So, for Advanced Ads, Ad Rotator, etc., you can essentially have that port of the page render with a different TTL than the rest of the page. Just modify the shortcode specification with three things:
1. esi – make that the shortcode identifier at the beginning of the shortcode
2. cache – you can specify public | private depending on the cache you’re targeting. For Ads that aren’t targeted you can choose public. Otherwise you can choose private if it’s for that specific user. The default is public.
3. ttl – you can specify a ttl in seconds if that block should have a different ttl than the page; the default is the ttl of that page.
So, if you use shortcodes like this to identify spots for an AD:
[the_ad_placement id=”between-posts-leaderboard-728×90″]
You can modify the caching of this block to make it never cache, and thus always render ad rotations because the php wordpress code is hit for the block every time, like this:
[esi the_ad_placement id=”between-posts-leaderboard-728×90″ cache=”public” ttl=”0″]
Pretty easy and it seems to work well although I’m not sure of the performance hit.