Caching isn’t really a difficult issue once the right key is chosen. Obviously the example above is really simplistic. The cache key for WPMU that runs this site goes something along the following lines..
if( count( $posts ) == 1 )
{
$smartyKey = md5( $comment_author_url.$comment_author.$comment_author_email.$user_login.$_SERVER[ 'REQUEST_URI' ] );
}
else
{
$smartyKey = md5( $user_login.$_SERVER[ 'REQUEST_URI' ] );
}

If you feed the root URL with the parameter, “clear=1”, that’ll clear out the cache too. Implementation details really!