I've just upgraded my Pi-Hole container to the latest version and I was wondering if there's a way to disable caching like with the CUSTOM_CACHE_SIZE environment variable that we could use on v5, without the need to rebuild a custom Pi-hole image or changing the cache size to zero from GUI.
Notice that the link to "DNS Cache Documentation", i.e. DNS cache - Pi-hole documentation, present in System Settings -> DNS Cache Metrics is not working
As you are already aware of how to change dns.cache.size via Pi-hole's All settings » DNS UI pane, you also already have the correct option name.
As mentioned in Introducing Pi-hole v6, Pi-hole's consolidated pihole.toml configuration file is not only richly commented, but can also be edited in a variety of ways:
Directly editing the toml file
Via the command line, e.g pihole-FTL --config dns.cache.size 0
Using the API
Via the web interface (which uses the API )
Via environment variables named, e.g FTLCONF_dns_cache_size=0
I've substituted the original examples with your sought option above, to better demonstrate how to apply a known option name.