[wp-hackers] Best Practices for Caching Plugin WidgetOutput?
mikeschinkel at gmail.com
Wed Dec 24 01:04:23 GMT 2008
Thanks for the response.
There is caching built into 2.7? Or are you talking about something like WP
As for using get_option(), I hadn't thought of that. I wonder if storing big
blocks of text that way isn't inefficient compared to using the file
system? Or maybe it's a trivial difference?
On Tue, Dec 23, 2008 at 7:36 PM, Stephane Daury <wordpress at tekartist.org>wrote:
> 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 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
>> from in instead to cache but I'm wondering if there is not a "standard"
>> 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
>> -Mike Schinkel
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers