Why Do We Need Cache?
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
will flush the cache and allow a newly-blacklisted (or whitelisted) domain to be answered correctly (see below).
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:
- your browser may cache content
- your operating system may cache DNS queries
- 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).