[wp-hackers] Best Practices for Caching Plugin WidgetOutput?

Mike Schinkel mikeschinkel at gmail.com
Wed Dec 24 00:17:36 GMT 2008


Hi all:

I'm wondering if there are any best practices for caching output generated
by a plugin widget?

I have written a simple plugin for a client that collects the top 10
categories in descending order based on a count of the number of posts. Of
course it doesn't make sense to run that SQL query for every page load.  I
could generate the list and then write it to a text file somewhere and read
from in instead to cache but I'm wondering if there is not a "standard" way
to cache the output?

Also I could just refresh periodically (hourly?) or maybe hooking when a
post is added/updated and/or a category applied/removed; suggestions on
this?

-Mike Schinkel
http://mikeschinkel.com/custom-wordpress-plugins/


More information about the wp-hackers mailing list