DreamPress is a supercharged, optimized for WordPress VPS from Dreamhost.  We run geistinteractive.com and modularfilemaker.org on it. It uses Varnish and Memcached to keep WordPress just zipping along. Overall I’d say we are pretty happy with it. But when you are developing your site, the aggressive caching can really throw you.  I have sent a lot time yelling at the browser, trying to figure out why something wasn’t showing up as it should.  I finally figured out a good way to deal with it.

Varnish

clearing DreamPress Cache

The problem is that between Varnish and Memcached just about everything is cached.  Unless you know how to clear the cache, the browser never sees any of it.  DreamPress auto-installs a Varnish WordPress plugin with a big ole Purge button on the dashboard that lets you easily clear Varnishes’ cache.  That same plugin also purges the cached posts when ever the get changed in WordPress.  So the plugin handles clearing DreamPress cache of all the content and the file based caches like the CSS and js files. But DreamPress installs another add on, and thats the one that frustrated me.

Memcached

DreamPress installs a WordPress “drop-in”, that replaces the built in php object cache with one backed by Memcached.  This means that when you are tweaking your php files, you may get fooled because memcache is serving up cached versions of the php objects.

Clearing DreamPress Cache – All of it!

Terminal to the rescue. After a brief exchange with DreamHost support I came up with an simple solution. First thing to do is log into the DreamPress server via SSH and cd to the web directory. On my server that’s the one named after the domain.  Then enter the following command on the command line.

curl -X PURGE “http://yourwebsite.com/.*” ; wp cache flush

The first part before the “;” handles Varnish the last part handles memcached.  Thats it.  Just re-enter the command any time you want to clear the cache.  That should do it! A simple one liner that makes clearing DreamPress cache simple.

PS.  Don’t forget to also clear your browser cache or turn it off 🙂