Periodically re-querying most used domain names

I have a upstream recursive caching DNS server on the same network as my Pi-hole. Currently it is dbndns but I plan to replace it with unbound soon. I do forward all DNS requests from the Pi-hole to this cache server.

On the cache server I use relatively low max cache TTL to quickly adapt to load balancers and keep all the nodes on my network connected to the fastest servers.

In cases when the cache server TTL expires, every recursive query delays the requests a little bit up-to 250-300 ms in the worst cases. It is not so horrible, but with relatively low cache TTL, it does happen quite often.

So I think it would be a very nice addition to Pi-hole - for similar setups like I have - to have a built in script the periodically keeps re-querying the most frequently used domain names. So this way, when the cache server already has expired TTL for those domains, then it could precache them, before new requests come in. And this could decrease the 250 ms resolution time to 3-6 ms every time, when the cache server could not serve data from its cache.

I imagine a settings panel with a very few parameters:
Status: On / Off
Number of domains: the N most used domain names.
Interval (in seconds): the interval to re-querying the domain names.

I know this could be done in other levels, but Pi-hole already has all the domain stats, and the most resource friendly way would be to have this feature embedded to the Pi-hole itself.

I know it will add some additional upstream traffic from the cache server to the upstream servers, but it would increase the overall speed of the whole network using my Pi-hole and my local caching server.

Closed as a duplicate of: