What’s the case against transient-ing almost everything that’s mostly static?

Actually, doing it for menu is good, you can even store entire HTML output and cut not only queries, but processing time too. Additionally, you can use WP_Object_Cache directly in conjunction with Redis/Memcached backend and avoid even single DB query for the transient itself.

Re comments – they do change, so running WP_Comment_Query is unavoidable. However, you can cache them as well, for some short amount of time. Say, 5 minutes. In this case, you need to find the balance between how much speed boost you gain and the delay before users will see their newly made comments.

Rule of thumb is, cache when needed, when it gives you positive impact and does not introduce negative impact.

WordPress already does great job in caching most important things (including menu items) – just put the object cache class in WP-content and add object cache backend on your server.

Leave a Comment