Re: questions about LRU implementation

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 17 Jan 2000 07:09:48 +0100

Kin-Yeung WONG wrote:

> When Squid receives a request, it first checks whether the requested
> object is cached or not by looking at the hash table.
> If not, then ask for the remote site.
> Otherwise, the node of requested object in the link list is moved to the
> head of the LRU list.

Yes.

> Here my question arises. How does Squid know the position of the
> requested object in the link list?

It doesn't. The LRU list is a doubly linked list.

> Are there address pointers stored in the hash table?
> If it is true, that means each time the link list changes, the hash
> table has to be updated?

Both the LRU list and the hash table indexes StoreEntry structures. The
indexes are otherwise separate from each other.

> On the other hand, when squid needs to replace cached objects, it takes
> objects from the tail of the LRU list.
> Is it correct that each time it takes objects from the list, the
> corresponding entries in the hash table has to be deleted?

Deleted objects are removed from both indexes yes.

--
Henrik Nordstrom
Squid hacker
Received on Sun Jan 16 2000 - 23:24:26 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:20 MST