What is the purpose of Java level DNS caching?

I am currently working on a project Android. I have a doubt that I am fixing DNS level caching . Thanks to the search, I found out that by calling the functions listed below, we can achieve it.

 System.setProperty( "networkaddress.cache.ttl", "0" );
 System.setProperty( "networkaddress.cache.negative.ttl", "0" );

Based on this, it caches name lookup data or not. I want to know the purpose or impact due to this property.

+3
source share
2 answers

The goal is to make fewer DNS queries. This leads to faster loading, since the IP for the hostname is already in the cache.

These are Java system properties that directly affect the standard network library. It allows you to configure Java-level DNS caching.

, , , , DNS .

0 ( ) -1 ( ) .

+3

, , . JVM

java.security.Security.setProperty( "networkaddress.cache.ttl", "10" );

( Android)

0

All Articles