Information that is cached by the resolver

Table 1 shows the application programming interfaces (APIs) that use resolver caching.

Table 1. APIs that use resolver caching
API Usage
getaddrinfo() Resolves host name to one or more IP addresses. Supports both IPv4 and IPv6 addresses.
gethostbyaddr() Resolves an IP address to a host name. Supports only IPv4 addresses.
gethostbyname() Resolves a host name to one or more IP addresses. Supports only IPv4 addresses.
getnameinfo() Resolves an IP address to a host name. Supports both IPv4 and IPv6 addresses.

The resolver caches the following DNS response information generated by the APIs in Table 1:

There is an upper limit on the amount of storage that can be used for negative caching information. The upper limit is 20 percent of the maximum amount of cache storage that the resolver is permitted to use. The resolver does not set aside this amount of storage for exclusive use by negative cache entries; rather, the resolver never exceeds this amount of storage to hold negative cache entries. When the upper limit is reached, no subsequent negative cache entries are saved until some existing entries are deleted and the negative cache entry storage use drops below the 20 percent upper limit. For information about setting the maximum amount of cache storage available to the resolver, see Steps for configuring resolver caching (optional).

The resolver does not cache information retrieved from local host files, such as /etc/hosts and /etc/ipnodes; that type of information is already cached at a process level. The resolver also does not cache information retrieved using an API not listed in Table 1.

The length of time that cache entries, including negative entries, are valid depends on the time-to-live (TTL) value that is returned by each domain name server. This is consistent with the behavior when using a caching-only name server or an intermediate name server to resolve a query.

In the following situations, cached entries are not saved up to the TTL value that is returned by the name server: