Looking at a WPMU Object Cache

In the good ol’ days WordPress came with a filesystem object cache but it was removed some time ago because it was a pain to maintain, and caused problems for some users, especially those using NFS. Nowadays there is an object cache built in, but the cache only survives for as long as a page is being served.
Other developers have taken up the challenge and produced object cache plugins to fill in the gap. There are the neosmart ones including a filesystem object cache and a memcached one (Read Andy’s notes before installing).

The neosmart filesystem object cache (and the others according to #988) don’t work correctly with WordPress MU so I dug up a patched version of the filesystem object cache I worked on a year ago to look for testers.

Download object-cache.txt, rename to .php and copy into wp-content/. It should start working automatically but if you don’t see files and directories in wp-content/cache/, make sure that directory is writeable by the webserver.

The neosmart version on which this one is based doesn’t handle switching blogs at all. Cache collisions occur with data from one blog’s options polluting the options in others. The version linked above should fix that but I’d appreciate some testing by others.

Oh, check out WordPress MU trunk now. I merged WP 2.8 beta1 and I’m fixing bugs. Please install and try it out on a test server! The get_option() and related code is using the same code as WordPress.org which is one of the main reasons I went digging into the object cache. It leans a lot more on the cache than previously. Please test!


21 Comments

ovidiu on May 26, 2009 at 8:51 pm.

just for the sake of completeness, don’t forget this one: http://murmatrons.armadillo.homeip.net/features/eaccelerator-wordpress-object-cache works perfectly with eaccelerator.

Reply

ovidiu on May 26, 2009 at 8:52 pm.

hey! has my comment been packed into the spam comments? ;-)

Reply

ovidiu on June 2, 2009 at 4:22 pm.

hey donncha, did you ever get around to check out the object cache, that uses eaccelerator as the backend? just google for: eaccelerator object cache murmatrons

and you’ll find it. I already tried psoting here with the link but it seems I get filtered as a spammer?

Reply

Donncha (1707 comments.) on June 2, 2009 at 4:57 pm.

Ovidiu – your comments were eaten by Akismet! Sorry!

Did you try that object cache with MU? I haven’t tried it but it’s easier to poison the cache in MU because of the blog switching it does.

I’d say the comments were eaten because that url is on a dynamic hostname. Wish he’d register his own domain or use WordPress.com/.org so I could stumble his site. I’ve tried several times..

Reply

ovidiu on June 2, 2009 at 5:23 pm.

:-) I have been happily using this eaccelerator compatible version for quite a while, never noticed any problems. Cache works quite good and in combination with the mod of your wp super cache plugin he made, I fully trust eaccelerator .-)

Reply

ovidiu on June 9, 2009 at 4:13 pm.

been mentioning your “quest” to that plugin author and here is his response: http://murmatrons.armadillo.homeip.net/features/eaccelerator-wordpress-object-cache#comment-328

basically it uses the blog_id for all keys except the global groups but read the whole answer for yourself…

Reply

ovidiu on August 3, 2009 at 1:28 pm.

any feedback on your survey? is this object cache working? is there another one? whats your opinion?

Reply

Donncha (1707 comments.) on August 4, 2009 at 12:05 pm.

No feedback unfortunately. It works fine on my test server but all I’ll guarantee is that it takes up space on your server. :)

Reply

Ray on August 26, 2009 at 9:13 pm.

Currently testing this, will let you know if I run into any problems.

Reply

dennyhalim.com on September 15, 2009 at 11:53 am.

can you update this to work with the latest wpmu:
http://quentin.unblog.fr/wordpress-mu-wpmu/wpmu-caching/wpmu-object-cache-using-apc/

it gives me this error:
Warning: Cannot modify header information – headers already sent by (output started at /website/wordpress-mu/wp-content/object-cache.php:184) in /website/wordpress-mu/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 48

tnx

Reply

Christopher (8 comments.) on October 2, 2009 at 4:24 am.

is this object cache file just for WPMU?

Reply

Christopher (8 comments.) on October 2, 2009 at 4:33 am.

I just tried it on a site with buddypress installed and I noticed the comments showing the generated time up about 30%

Reply

Olivier on November 1, 2009 at 2:29 pm.

This is what happened when i enabled object-cache on our wpmu install: http://i38.tinypic.com/28icec1.png

Donncha, any ideas what happens here? It’s obviously doing more than just taking up space. ;)

Reply

Jan (1 comments.) on April 7, 2010 at 10:11 am.

Hello Donncha, is this drop-in object-cache.txt still working with a multisite WP 3.0 installation? When I rename the file to object-cache.php and put it into wp-content, I see this message in my “Manage Plugins”-section:

“The plugin 0 has been deactivated due to an error: Plugin file does not exist.”

When I remove the drop-in, the message is no longer displayed.

Reply

Steve (4 comments.) on June 22, 2010 at 7:57 am.

I’ve got the same problem Jan and oddly enough the performance issues I have with the back end go away if I remove the object-cache drop-in

Reply

Ahmed Ibrahim (1 comments.) on October 20, 2010 at 12:52 am.

Hi,
nice post
In your version of object-cache, you used this line
$data = unserialize(serialize($data));
I really don’t get it why u r serializing and unserializing the $data in the same step, what changes will happen to $data after this step.

Reply

Donncha (1707 comments.) on October 20, 2010 at 4:53 pm.

Ahmed – I think that’s just the way it was done and code in the original object cache.

Reply

Leave Your Comment

Your email will not be published or shared. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Holy Shmoly! is Stephen Fry proof thanks to caching by WP Super Cache