]> git.ipfire.org Git - thirdparty/squid.git/blob - doc/Programming-Guide/StorageManager.dox
Source Format Enforcement (#532)
[thirdparty/squid.git] / doc / Programming-Guide / StorageManager.dox
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /**
10 \defgroup StorageManager Storage Manager
11 \ingroup Components
12 *
13 \par
14 The Storage Manager is the glue between client and server
15 sides. Every object saved in the cache is allocated a
16 StoreEntry structure. While the object is being
17 accessed, it also has a MemObject structure.
18
19 \par
20 Squid can quickly locate cached objects because it keeps
21 (in memory) a hash table of all StoreEntry's. The
22 keys for the hash table are MD5 checksums of the objects
23 URI. In addition there is also a storage policy such
24 as LRU that keeps track of the objects and determines
25 the removal order when space needs to be reclaimed.
26 For the LRU policy this is implemented as a doubly linked
27 list.
28
29 \par
30 For each object the StoreEntry maps to a cache_dir
31 and location via sdirn and sfilen. For the "ufs" store
32 this file number (sfilen) is converted to a disk pathname
33 by a simple modulo of L2 and L1, but other storage drivers may
34 map sfilen in other ways. A cache swap file consists
35 of two parts: the cache metadata, and the object data.
36 Note the object data includes the full HTTP reply---headers
37 and body. The HTTP reply headers are not the same as the
38 cache metadata.
39
40 \par
41 Client-side requests register themselves with a StoreEntry
42 to be notified when new data arrives. Multiple clients
43 may receive data via a single StoreEntry. For POST
44 and PUT request, this process works in reverse. Server-side
45 functions are notified when additional data is read from
46 the client.
47
48 */