Could someone add some context please? I see that apparently the method to flush the DNS cache changes between versions. Is there a deeper reason why this is necessary?
* Snow Leopard and earlier use lookupd for DNS resolving (`dscacheutil -flushcache`)
* Since Lion, they switched from lookupd to mDNSResponder, presumably for Bonjour protocol support (`killall -HUP mDNSResponder`)
* Yosemite switched to discoveryd that basically is a rewrite of mDNSResponder (`discoveryutil mdnsflushcache`)
* Due to a lot of problems with discoveryd, they switched from discoveryd back to mDNSResponder since v10.10.4 (so we're back to `killall HUP mDNSResponder`)
So I see absolutely no point here.
dscacheutil -q host -a name www.example.com
On the topic, easiest way to see if dscacheutil -flushcache work or not is to probably do something like: dscacheutil -q host -a name www.example.com
# Make sure it's in the cache prior to running.
sudo dscacheutil -flushcache
dscacheutil -q host -a name www.example.com
# Notice if there's a slight delay for the lookup.
sudo killall -HUP mDNSResponder
dscacheutil -q host -a name www.example.com
# Notice if there's a slight delay for the lookup.