resolvectl statistics
or
systemd-resolve --statistics
returns:
DNSSEC supported by current servers: no Transactions Current Transactions: 0 Total Transactions: 1163 Cache Current Cache Size: 33 Cache Hits: 879 Cache Misses: 284 DNSSEC Verdicts Secure: 0 Insecure: 0 Bogus: 0 Indeterminate: 0
NOTE: The Current Cache Size is the value you're looking for.
If it's 0, you just flushed the DNS cache.
The cache can store up to 4096 DNS responses for up to 2 hours, so don’t expect to see a massive number listed as the current cache size.
The DNS cache can’t grow to more than 420 kB when used to its fullest; so no concern about memory usage.