To find a cache entry on disk, you need to know its PrimaryKey and its CacheIndex. If you only have the CacheIndex, you can use the GraphLog to find the PrimaryKey (see CacheUnderTheHood/PrimaryKeyFromCacheIndex).
The collection of all entries with the same primary key is called a PKFile. A cache entry on disk is found in its PKFile.
Because there can be a very large number of PKFiles (up to 2^128 as primary keys are 128-bit numbers), the cache groups PKFiles together on disk rather than creating one file per PKFile. Currently this grouping is done using the first 16 bits of the primary key. Such a collection of PKFiles with the same prefix is called a MultiPKFile.
Suppose we're looking for CacheIndex 1234 that has the PrimaryKey:
- 17973c765efe206e 982e987fd2796a69
We need to first 16 bits (first 4 hex digits) from the PrimaryKey:
- 1797
This is called a primary key prefix or PK prefix. It uniquely identifies a MultiPKFile.
Next we need to know where the cache server stores its data. To find out we can use WhichCache:
% WhichCache Cache information: Hostname: vesta.example.com Port number 21773 Stable root: /var/lib/vesta/cache
Inside the "Stable root" there is a directory named "sCache" in which the MultiPKFiles are stored. (Actually, you can change the name of this directory with [CacheServer]SCacheDir in vesta.cfg, but nodoy ever does.)
Inside the "sCache" directory, there is a directory named "gran-16". (The name comes from the fact that MultiPKFiles use a granularity of 16 bits to group the PKFiles.)
Inside the "sCache/gran-16" directory there are directories with the first 8 bits of each PK prefix. Inside those directories are files named with the second 8 bits of the PK prefix. So with our example PK prefix of 1797, the MultiPKFile would be:
- /var/lib/vesta/cache/sCache/gran-16/17/97
The PrintMPKFile utility prints the contents of a MultiPKFile:
% PrintMPKFile /var/lib/vesta/cache/sCache/gran-16/17/97 // ########################################################################## // <MultiPKFile> (/var/lib/vesta/cache/sCache/gran-16/17/97) // ########################################################################## num = 1 pk = 17973c765efe206e 982e987fd2796a69, offset = 38 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // <PKFile> (offset 38) // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pk = 17973c765efe206e 982e987fd2796a69 num = 2 cfp = 629a34e80c8ec9d9 6155f94e77c3face, offset = 24001 cfp = 30d322d7b22b9943 8b0f15e4dd209280, offset = 133205 // <PKEntries> (offset 24001) numEntries = 1 // <PKEntries> (offset 133205) numEntries = 1
You can get a lot more information by giving PrintMPKFile the "-verbose" command-line flag.