Flush BlobCache on all Servers In the Farm

A colleague of mine was working on a BlobCache issue with a customer.  During troubleshooting, they wanted to flush the cache store on all the servers in the farm.  Under Site Settings, we provide site administrators the option to flush the cache on “this server”, but not on all servers in the farm.  Now if you have one or two WFE servers in the farm, this isn’t a big deal, but if you have a bunch, it can be very time consuming to force your connection to a specific WFE and execute the cache flush.




Some research into this page a bit more, I found we actually have a check box build into the Object Cache Settings page to allow a site administrator to flush the cache on the farm, but it’s not visible.  I have no idea why, but it would be very handy to have this feature available from the browser.  I have yet to find a solution to flush the cache without requiring server access.  However, if you have server access, you can execute the following sequence of STSADM commands to force a flush of the cache on all the servers. We need to first execute the following to get the current property value:

stsadm -o getproperty -pn blobcacheflushcount -url <Web App or Site URL>

This command will return some XML, like the following:

<Property Exist="Yes" Value="1" />

The value attribute of this XML represents a incrementing value we store internally to determine when the farm should flush the blob cache.  To force the cache to flush, we need to increment this value, which can be accomplished using the following command:

stsadm -o setproperty -propertyname blobcacheflushcount -propertyvalue <value returned from “get” command +1> -url <Web App or Site URL>