Previous: Memory cache, Up: Caching

### 4.3 The on-disk cache

The on-disk cache consists in a filesystem subtree rooted at a location defined by the variable `diskCacheRoot`, by default `"/var/cache/polipo/"`. This directory should normally be writeable, readable and seekable by the user running Polipo. While it is best to use a local filesystem for the on-disk cache, a NFSv3- or AFS-mounted filesystem should be safe in most implementations. Do not use NFSv2, as it will cause cache corruption 1.

If `diskCacheRoot` is an empty string, no disk cache is used.

The value `maxDiskEntries` (32 by default) is the absolute maximum of file descriptors held open for on-disk objects. When this limit is reached, Polipo will close descriptors on a least-recently-used basis. This value should be set to be slightly larger than the number of resources that you expect to be live at a single time; defining the right notion of liveness is left as an exercise for the interested reader.

The value `diskCacheWriteoutOnClose` (64kB by default) is the amount of data that Polipo will write out when closing a disk file. Writing out data when closing a file can avoid subsequently reopening it, but causes unnecessary work if the instance is later superseded.

The integers `diskCacheDirectoryPermissions` and `diskCacheFilePermissions` are the Unix filesystem permissions with which files and directories are created in the on-disk cache; they default to ``0700`' and ``0600`' respectively.

The variable `maxDiskCacheEntrySize` specifies the maximum size, in bytes, of an instance that is stored in the on-disk cache. If set to -1 (the default), all objects are stored in the on-disk cache,

#### Footnotes

[1] Polipo assumes that ``open(O_CREAT | O_EXCL)`' works reliably.