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:
  • Forward lookup information (IP addresses as A or AAAA records)

    Forward lookups are host-name-to-IP-address resolution requests. This includes IPv4 (A records) and IPv6 (AAAA records) addressing records from getaddrinfo() and gethostbyname() API calls.

  • Reverse lookup information (domain name pointers as PTR records)

    Reverse lookups are IP-address-to-host-name resolution requests. This includes records from getnameinfo() and gethostbyaddr() API calls.

  • Negative caching (NX) information

    Negative caching is the storage of the knowledge that a record does not exist, or that a request for a specific resource cannot or does not give an answer. The negative cache represents the received NXDOMAIN (nonexistent domain) responses from the server. The negative cache also represents the received NOERROR responses that did not include answer records of the requested type, such as a request for IPv6 addresses when the resource has only IPv4 addresses defined. Negative cache entries represent resources that are known to not exist and they include both reverse and forward entries.

Notes: Start of change
  • IP addresses cached by getaddrinfo() and gethostbyname() API calls can be returned in a round-robin manner if CACHEREORDER is enabled.
  • Sorting algorithms, such as the SORTLIST statement, might affect the results of the cache reordering logic. See Interactions of address sorting and cache reordering for more information.
End of change

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: