Does it hurt to replace this piece of code with...

From: Yee Man Chan <ymc@dont-contact.us>
Date: Wed, 4 Mar 1998 22:34:27 -0500 (EST)

I want to implement LFU in Squid but I am not sure whether I can get rid
of the LRU code in storeMaintainSwapSpace. Do I need to take any
precautions after I remove the following code by #ifdef? Does this piece
of code change anything crucial? The way I do the LFU is to change the
somehow deprecated storeGetSwapSpace and then call it inside
storeComplete.

In storeMaintainSwapSpace (Squid ver 1.1.20):

    /* Purges expired objects, check one bucket on each calling */
    if (squid_curtime - last_time >= store_maintain_rate) {
        for (;;) {
            if (scan_obj && scan_buckets >= store_maintain_buckets)
                break;
            if (++scan_buckets > 100)
                break;
            last_time = squid_curtime;
            if (bucket_index >= store_buckets) {
                bucket_index = 0;
                scan_revolutions++;
                debug(51, 1, "Completed %d full expiration scans of store
table\n",
                    scan_revolutions);
                storeRandomizeBuckets();
            }
            b = MaintBucketsOrder + bucket_index++;
            next = hash_get_bucket(store_table, b->bucket);
            while ((link_ptr = next)) {
                scan_obj++;
                next = link_ptr->next;
                e = (StoreEntry *) link_ptr;
                if (!storeCheckExpired(e, 1))
                    continue;
                rm_obj += storeRelease(e);
            }
        }
    }
    debug(51, rm_obj ? 2 : 9, "Removed %d of %d objects from bucket %d\n",
        rm_obj, scan_obj, (int) b->bucket);
    /* Scan row of hash table each second and free storage if we're
     * over the high-water mark */
    storeGetSwapSpace(0);

------
Thanks for attention,
Yee Man Chan
A Squid Beginner
Received on Wed Mar 04 1998 - 19:43:08 MST

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