Re: [squid-users] PushCache Patch: store_swapout.c question

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 14 Dec 2004 05:32:38 +0100 (CET)

On Mon, 13 Dec 2004, OTR Comm wrote:

> When a file is written to cache, where does Squid figure out which cache
> directory to store the file in?

By cache directory, do you refer to which cache_dir (when you have
multiple in squid.conf) or which file number within the cache_dir?

If the first then this is per the cache_dir selection algorithm, default
least-load.

If the latter then this is cache_dir type dependent, but all of
ufs/aufs/diskd uses a similar method; a bitmap of free file numbers.

> /usr/local/squid/var/cache/00/00/00000000
>
> what I need to know is where does squid genetrate the '00/00' part of
> the path? And how does 'dirno 0' enter into this calculation?

dirno is the cache_dir number. If you only have a single cache_dir
directive then you only have dirno 0.

fileno is the file number within that cache_dir. The layout of the
ufs/aufs/diskd file structure is dependent on the L1 & L2 parameters.

cache_dir/D1/D2/filenumber

  D2 = filenumber % L2
  D1 = ( filenumber / L2 ) % L1

or in other words, Squid places L2 files in each L2 directory, and L2 L2
directories in each L1 directory. All starting at 0 and growing upwards.

> What I am trying to do is make a record in MySQL of each file pushed to
> the server so I can go back to each of the cache entries by path and
> filename, and work with the specific file.

You should not access the on-disk cache file manually unless you have very
specific reasons for doing so.

What is is really you want to do with the cache?

Regards
Henrik
Received on Mon Dec 13 2004 - 21:32:40 MST

This archive was generated by hypermail pre-2.1.9 : Sat Jan 01 2005 - 12:00:02 MST