Squid Web Cache wiki

Squid Web Cache documentation

๐Ÿ”— IP Cache and FQDN Cache

๐Ÿ”— Introduction

The IP cache is a built-in component of squid providing Hostname to IP-Number translation functionality and managing the involved data-structures. Efficiency concerns require mechanisms that allow non-blocking access to these mappings. The IP cache usually doesnโ€™t block on a request except for special cases where this is desired (see below).

๐Ÿ”— Data Structures

The data structure used for storing name-address mappings is a small hashtable (static hash_table *ip_table), where structures of type ipcache_entry whose most interesting members are:

    struct _ipcache_entry {
            char *name;
            time_t lastref;
            ipcache_addrs addrs;
            struct _ip_pending *pending_head;
            char *error_message;
            unsigned char locks;
            ipcache_status_t status:3;
    }

๐Ÿ”— External overview

Main functionality is provided through calls to:

๐Ÿ”— Internal Operation

Internally, the execution flow is as follows: On a miss, ipcache_getnbhostbyname checks whether a request for this name is already pending, and if positive, it creates a new entry using ipcacheAddNew with the IP_PENDING flag set . Then it calls ipcacheAddPending to add a request to the queue together with data and handler. Else, ipcache_dnsDispatch() is called to directly create a DNS query or to ipcacheEnqueue() if all no DNS port is free. ipcache_call_pending() is called regularly to walk down the pending list and call handlers. LRU clean-up is performed through ipcache_purgelru() according to the ipcache_high threshold.

Navigation: Site Search, Site Pages, Categories, ๐Ÿ”ผ go up