]> git.ipfire.org Git - thirdparty/squid.git/blame - src/store_digest.cc
missing newline in cachemgr output
[thirdparty/squid.git] / src / store_digest.cc
CommitLineData
8638fc66 1/*
2 * $Id: store_digest.cc,v 1.1 1998/04/02 17:11:27 rousskov Exp $
3 *
4 * DEBUG: section 71 Store Digest Manager
5 * AUTHOR: Alex Rousskov
6 *
7 * SQUID Internet Object Cache http://squid.nlanr.net/Squid/
8 * --------------------------------------------------------
9 *
10 * Squid is the result of efforts by numerous individuals from the
11 * Internet community. Development is led by Duane Wessels of the
12 * National Laboratory for Applied Network Research and funded by
13 * the National Science Foundation.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 *
29 */
30
31#include "squid.h"
32
33void
34storeDigestInit()
35{
36 /*
37 * To-Do: Bloom proved that the optimal filter utilization is 50% (half of
38 * the bits are off). However, we do not have a formula to calculate the
39 * number of _entries_ we want to pre-allocate for.
40 * Use 1.5*max#entries because 2*max#entries gives about 40% utilization.
41 */
42 const int cap = (int)(1.5 * Config.Swap.maxSize / Config.Store.avgObjectSize);
43#if SQUID_MAINTAIN_CACHE_DIGEST
44 store_digest = cacheDigestCreate(cap);
45#else
46 store_digest = NULL;
47#endif
48 cachemgrRegister("store_digest", "Store Digest",
49 storeDigestReport, 0);
50}
51
52/* rebuilds digest from scratch */
53void
54storeDigestRebuild()
55{
56 assert(store_digest);
57}
58
59void
60storeDigestReport(StoreEntry *e)
61{
62 if (store_digest) {
63 cacheDigestReport(store_digest, "store", e);
64 } else {
65 storeAppendPrintf(e, "store digest: disabled.\n");
66 }
67}
68