[wp-hackers] $wpdb cacheing?

Stephen Rider wp-hackers at striderweb.com
Mon Aug 20 12:02:23 GMT 2007


On this page <http://codex.wordpress.org/Function_Reference/WP_Cache>  
it says:

"Caching is not enabled by default."

So I'm confused as to why caching is happening anyways.  Unless that  
sentence is incorrect in the Codex?

Anyway, thanks for the help.  I may use raw SQL if I must (last  
resort) but I'd much rather reference existing functions for future  
compatibility.

I think what I might try is to unset the wp_pages cache info, run the  
new query, and then set it again.  If I can figure out how to cache  
_my_ function's data, all the better!  :)

Again, thanks Aaron and Jacob.

Stephen


On Aug 19, 2007, at 11:36 AM, Aaron Brazell wrote:

> WP instantiates the db data for a single blog and the cache  
> mechanism revolves around that. I have not tried messing with  
> double installs in the same db so my advice might be bunk, however  
> your best bet is probably raw SQL.
> (via Blackberry)
> Aaron Brazell
> Director of Technology, b5media
> "A Global New Media Company"
>
> web:: www.b5media.com, www.technosailor.com
> phone:: 410-608-6620
> skype:: technosailor
>
> -----Original Message-----
> From: Stephen Rider <wp-hackers at striderweb.com>
>
> Date: Sun, 19 Aug 2007 03:59:01
> To:wp-hackers at lists.automattic.com
> Subject: [wp-hackers] $wpdb cacheing?
>
>
> Hi --
>
> I'm trying to make a function that gets a combined list of Pages from
> two different blogs (both in the same database)
>
> Since the login info is the same, it occurred to me to try changing
> the table prefix to get the second blog's data.  Here's the code:
>
> $mbpages1 = get_pages( $args );
> $orig_prefix = $wpdb->prefix;
> $wpdb->prefix = 'blah_';
> $mbpages2 = get_pages( $args );
> $mbpages1 = array_merge( $mbpages1, $mbpages2 );
> $wpdb->prefix = $orig_prefix;
>
> It pulls the first blog's data twice.
>
> Is the get_pages being cached somehow?  Is there a way to reset the
> cache so it pulls the different data?
>
> ....and if I do that, is there a way for me to cache the combined list
> and thus avoid a big performance hit?
>
> My head hurts.  Thanks in advance.
>
> Stephen


More information about the wp-hackers mailing list