[wp-hackers] Questions about the Cache

Viper007Bond lists at viper007bond.com
Wed Jul 19 11:27:07 GMT 2006


Er, whoops, didn't read the rest of your e-mail and hit submit by accident.

To do what you want, I suggest querying them all and then storing them 
as an option in the database. When you fetch the option value (the 
data), it'll be pulled from the cache.

Check out one of my plugins for an example:

http://www.viper007bond.com/wordpress-plugins/clean-archives-reloaded/

It does basically exactly the kinda thing you're doing. Without caching, 
it does ~300 queries. With the caching of the output to one option, it 
cuts it down to just 2 or 3 and then with WordPress' caching on, it cuts 
it down to just one I believe. :)

-Viper

Mark Harwood wrote:
> Hey guys, im trying to make some of my basic WordPress functions a bit 
> more cache friendly, but i have a feeling that because my dev server is 
> on a Windows box its having a bit of trouble working properly.
> 
> Can someone explain how the cahce works? i can push the data needed into 
> the $wp_object_cache Object with ease, but it does not seem to keep it 
> there.
> 
> I cant seem to figure out how to actualy save settings to the cache for 
> the full expire limit, it just seems to be in $wp_object_cache for the 
> time you init the page load.
> 
> I basicly wish to cash the full list of users on my website as i use 
> ther data alot and dont want to have to call MySQL everytime.
> 
> See: http://www.mem-gaming.co.uk/v2/index.php/profiles/
> 
> It takes ages to load the page and i think its down to the way i pull 
> out the userdata as a whole.
> 
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list