*the code was updated 8/2/2011 with some insight from Mrunal Brahmbhatt. Much appreciated.
So I recently upgraded my system to Sitecore 6.4 from Sitecore 6.2 and was pumped about a lot of the new features like multi-browser support, new Rich Text Editor but mostly, the new built-in multi-target cache management system. Now I have to say that when I heard the words "partial cache clearing" I completely misunderstood what it meant. I thought it was partial html cache clearing thinking that when a single page got published, just that item was removed from cache. The truth is that when anyone publishes anything all html cache for all sites defined under the web.config's "publish:end" or "publish:end:remote" event are cleared. Sitecore manages a lot more cache than just html cache so by their thinking when just the html cache is cleared, that is just part of all the cache they're working with. In this way they're right, but this strategy is a problem for my particular system because of the large number of sites and editors working on it at any given time. The continually growing number of sites means that I rely on the html cache a lot to minimize the workload on the servers and keep sites loading quickly. I had solved this same issue working with the Stager Module but doing it with this new system is a bit different. Before I go into details about how to do this I will say that I am expecting that you have already setup your system as a mutli-target platform and have properly configured your ScalabilitySettings.config file. If you're looking for more on how to setup a multi-target platform then I'd suggest first starting by reviewing the scaling guide on SDN first which answered all my question about how to get it working.
If you're on a Sitecore environment pre-6.3 and you're using the Sitecore Stager you may have noticed that each publish will clear the entire HTML for a site. This may be fine for you but I like to have more granular control over the cache so I've updated the source code a bit to clear only entries related to the published items. I'm not going to knock the Sitecore Stager, it's an excellent utility. Plus this why they release source code in the first place.