Sometimes I want to ask the Mac itself what a name or an address maps to. dscacheutil has a host query for that, and it also shows what sits in the Directory Service cache.
The man page says -q starts a query using standard calls. The results either come from the cache or are fetched live and then placed in the cache. For the host category the key is name or ip_address, and it covers both IPv6 and IPv4:
dscacheutil -q host -a name example.com
The other direction uses the same category:
dscacheutil -q host -a ip_address 192.168.1.10
Leave out -a and you get everything in that category, so dscacheutil -q user lists all users. The other categories are group, mount, protocol, rpc and service.
Two read-only switches are worth knowing. -statistics prints cache statistics, and -configuration prints the current configuration, such as the search policy from Directory Service and the cache parameters. -cachedump gives an overview of the cache, and adding -entries host dumps the host entries, which only administrative users can do.
The caveat is -flushcache. It flushes the entire cache, and the man page says it should only be used in extreme cases, because validation information in the cache is part of how the OS makes sure it has valid data. I would look at the statistics first and leave the flush alone.
Further reading: dscacheutil man page