[wp-hackers] overriding the built-in cache

Mark Jaquith mark.wordpress at txfx.net
Fri Jan 6 01:36:43 GMT 2006

You are running your plugin on the shutdown function, as I recall.   
add_action('shutdown' 'your_function'); or something.

Here is the relevant code in wp-settings.php:
> function shutdown_action_hook() {
> 	wp_cache_close();
> 	do_action('shutdown');
> }
> register_shutdown_function('shutdown_action_hook');

Notice that wp_cache_close() is called before your function is run.

wp_cache_close() calls $wp_object_cache->save() which appears to take  
all the changes that have been made, and writes them to the cache.   
But because you do your update_option() after the saves, they don't  
make it in.

Try running wp_cache_close() at the end of your shutdown function,  
and see if that helps to commit the changes.

>> On 05/01/06, Scott Merrill <skippy at skippy.net> wrote:
>>> I am having some trouble with my wp-cron plugin, and I'm pretty sure
>>> it's the new caching mechanism that's causing it.
>> I thought one of the options this discussion in #wordpress produced
>> was to use a direct query via $wpdb: did this not work?
> I haven't gone the direct query route yet, because of Ryan's  
> comments in
> the category cache discussion

Mark Jaquith

More information about the wp-hackers mailing list