]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/mem/Pages.cc
4 * DEBUG: section 54 Interprocess Communication
9 #include "base/TextException.h"
10 #include "ipc/mem/PagePool.h"
11 #include "ipc/mem/Pages.h"
15 // Uses a single PagePool instance, for now.
16 // Eventually, we may have pools dedicated to memory caching, disk I/O, etc.
18 // TODO: make pool id more unique so it does not conflict with other Squids?
19 static const String PagePoolId
= "squid-page-pool";
20 static Ipc::Mem::PagePool
*ThePagePool
= 0;
22 // XXX: temporary function until we have a better page size handling
26 unsigned int max_objsize
= 0;
27 for (int i
= 0; i
< Config
.cacheSwap
.n_configured
; ++i
) {
28 const SwapDir
*const sd
= dynamic_cast<SwapDir
*>(INDEXSD(i
));
29 if (sd
->max_objsize
> max_objsize
)
30 max_objsize
= sd
->max_objsize
;
39 // XXX: pool capacity and page size should be configurable/meaningful
40 ThePagePool
= new PagePool(PagePoolId
, 1024, calculatePageSize());
47 // TODO: make pool id more unique so it does not conflict with other Squid instances?
48 ThePagePool
= new PagePool(PagePoolId
);
52 Ipc::Mem::GetPage(PageId
&page
)
55 return ThePagePool
->get(page
);
59 Ipc::Mem::PutPage(PageId
&page
)
62 ThePagePool
->put(page
);
66 Ipc::Mem::PagePointer(const PageId
&page
)
69 return ThePagePool
->pagePointer(page
);