The invention discloses a DNS cache
processing method, which comprises the following steps of: storing a corresponding relationship between domain names and IP (
Internet Protocol) addresses of DNS caches by adopting a dictionary
tree structure, representing the domain names by using character strings corresponding to node paths, and storing the IP addresses corresponding to the domain names by using the positions of nodes; when the data is inserted, creating a node according to a character path in the
domain name character string, and storing an
IP address corresponding to the
domain name intothe node corresponding to the
domain name; and when the
IP address corresponding to the domain name is queried, searching the node in the tree according to the character string path in the domain name character string, and obtaining the corresponding
IP address stored in the node position after the node is found. According to the DNS cache
processing mode provided by the invention, the storage space occupation can be greatly reduced while the stable and efficient query efficiency is obtained. According to the method, meaningless character string comparison is reduced, and the query efficiencyis high; the storage space does not need to be pre-allocated, and the occupied space is small; hash
processing is not carried out on the data, and no conflict is generated.