I have some query that brings around 50+ posts (I know it’s not ideal but had to do that to build something the client asked..) and a set of loops to order them in a certain way and it looks like that this sequence is delaying parts of the rendering of the page.
I’d like to cache in a transient this entire block of rendered HTML, is that possible?
Transients API documentation formulates suggested usage as:
Your case seems like a perfect fit for this description. On technical side you will need to concatenate your output into variable and put into transient, instead of displaying it.
If I were to implement this today, my preference would be the memcache object cache, storing the data using
wp_cache_set()
, possibly updating the data using WP_Cron rather than during page load.Just how many kilobytes are we talking about?