On Mon, 17 Jan 2000, Kin-Yeung WONG wrote:
> Hi,
>
> I am very enthusiastic about the internal operations of Squid.
> I did try to know more about that by looking into the Squid source but
> it is really difficult for me to achieve it.
>
> >From the Squid Programmers Guide I know that, to implement the LRU, a
> hash table and a double link list are used.
> I just want to clarify the operations of the LRU. Are the operations
> like these:
>
> When Squid receives a request, it first checks whether the requested
> object is cached or not by looking at the hash table.
yes.
> If not, then ask for the remote site.
yes.
> Otherwise, the node of requested object in the link list is moved to the
> head of the LRU list.
Essentially, an object is moved to the head of the list every time
that it is accessed by a client.
> Here my question arises. How does Squid know the position of the
> requested object in the link list?
It doesn't know, and it doesn't need to know.
> Are there address pointers stored in the hash table?
A StoreEntry knows about the entry that is before it, and about the
entry that is after it in the list.
> If it is true, that means each time the link list changes, the hash
> table has to be updated?
No, the hash table and the double-linked list are separate. We can
update one without affecting the other.
> On the other hand, when squid needs to replace cached objects, it takes
> objects from the tail of the LRU list.
yes.
> Is it correct that each time it takes objects from the list, the
> corresponding entries in the hash table has to be deleted?
Yes, the hash table must be updated when an object is removed.
Duane W.
Received on Tue Jan 18 2000 - 18:57:05 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:20 MST