I have setup this wordpress installation as a network of sites using the built in WordPress support for site networks. All of the sites are running on separate domains but WordPress is setup to use subdirectories for the different sites. So this blog is actually installed at /nsilverbullet in wordpress. To map from subdirectories to domains I am using the WordPress MU Domain Mapping plugin.
Unfortunately WordPress MU Domain Mapping and W3 Total Cache do not play nicely together… The issue isn’t actually with either plugin but with how WordPress sets itself up on each request. The two plugins are both setup and activated the way WordPress wants them to be – W3 Total Cache is activated using the advanced_caching dropin and MU Domain Mapping gets to redirect the request using sunrise.php. This is as it should be, unfortunately W3 Total Cache uses GLOBALS[‘blog_id’] to create cache keys for different blogs in a network installation. MU Domain mapping sets the current blog id when sunrise.php is executed – this occurs after advanced caching is run. So W3 Total Cache never gets the right blog id when it does output buffering(it defaults to 1 on every request) but does get the right blog id when you do admin actions on your sites. This has the unfortunate effect of creating all cache files for domainname.com_1 but when the blog_id is 2 W3 Total Cache trys to purge cache files for domainname.com_2, the cache works but is never purged automatically. Purgin manually using the Admin interface still works.
To get around this issue I have edited some of the files for W3 Total Cache, but since this is really hacky (and error prone) I am going to create a custom plugin using the action hooks which are exposed by W3 Total Cache. I’ll post it when it is completed.