Wordpress LScache Plugin: Pre-cache ESI blocks
Last Updated on: Wed, 15 Apr 2026 00:00:02 I love ESI. It changed my world! However, in writing Litespeed specific code for a plugin I need to find a way to preload ESI blocks so they dont have to wait for a page visitor to initiate the Ajax calls. The crawler does well for pages, but not dynamic ESI blocks ( understandably ). The TTL is very short on these blocks, as is necessary in this situation, but if it is on a low traffic site they will wait for these blocks to load the first time ( php generated data ). Second time ? its cached and fast. Is there a way I can do this? Posting here is my last resort after melting my brain trying to make this happen. No is a valid response Though a mind bending complicated code solution would be preferred. Congratulation! You noted the disadvantage of ESI, but the problem isnt caused by ESI itself. It is caused by WordPress and any other application that uses a PHP framework. If a PHP framework is used the size of ESI hole doesnt matter, because the load for the ESI hole is as high as for the complete site and thats why the first page load takes as much time as without cache, almost. You can only use a trick to solve it that guest mode already does, but dont know if guest mode respects ESI for the first load. On all my sites, where I dont use WP, visitors see a fullpage GDPR consent page. No other content will be loaded as long user doesnt consent. ESI is also disabled. If user consent a cookie will be set and the page will be reloaded. Reloading takes almost no time, but if the cookie is set a new cache vary is used and this cache vary enables ESI. This is the same behaviour as with guest mode, but my solution needs a user action to do the same like guest mode. The result is the same, a fast first page load, because ESI is enabled first if user consent. Hi, unfortunately no , I can only think of as to increase the crawler activity to compensate the ESI blocks short life.
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference