Cache plays an important role with Pi-hole. This is part of the reason Pi-hole can make your network perform faster. Once a queried domain name has been cached, future replies for that same domain name will be much faster since Pi-hole already knows about it.
Problems When White Or Black Listing
However, you can run into issues if you decide to white or blacklist a domain that is already cached. For example, if you saw ads on a site and decided to blacklist wsp.mgid.com, you may not immediately see the ads disappear. This is most often due to caching.
Since Pi-hole already responded to a query for wsp.mgid.com, it doesn't know that this domain should be blocked until you flush the cache--even though it exists on the blacklist. Pi-hole won't know about this change until the cache is flushed (or the cache expires, which is defaulted to 300 seconds).
Flushing The Cache
But running
pihole restartdns
will flush the cache and allow a newly-blacklisted (or whitelisted) domain to be answered correctly (see below).
More Complexity
You may find that running that command still does not make whatever site you are visiting to display properly. This is because cache exists in several other places:
other apps or systems used to access your domain may use cache along the way
because of this, you may need to flush cache in one or more of the above places before you see an effect (in addition to restarting Pi-hole's DNS server).
A question on flushing the DNS cache, dealing with a Whitelist issue. If temporarily halting Pi-Hole causes the expected behavior and resuming Pi-Hole causes the whitelist entry to again be ignored, does that point away from an issue with the browser or device/OS cache?