[wp-hackers] Best Practices for Caching Plugin WidgetOutput?
wordpress at tekartist.org
Wed Dec 24 00:36:04 GMT 2008
If the wp install has caching enabled, the widget's output will be
automatically cached (right?).
Otherwise, if you want to "cache" it regardless of if the install has
caching enabled, you could use update_option() and get_option(), with
a small time-based expiry mechanism.
On Dec 23, 2008, at 19:17, Mike Schinkel wrote:
> Hi all:
> I'm wondering if there are any best practices for caching output
> 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
> -Mike Schinkel
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers