multiple segments of shared memory?
| From: | Alexander Romanovich | Date: | Tue, 08 Feb 2011 16:32:34 +0000 |
| Subject: | multiple segments of shared memory? | ||
| Groups: | php.apc.dev | ||
| Request: | Send a blank email to php-apc-dev+get-266@lists.php.net to get a copy of this message | ||
Is there any way to use segmented pools of shared memory in APC? In other words, as far as I can
tell, all apc_add() calls store their values in a single pool of memory whose size is set in
php.ini. However, I'd love to be able to set a limit on how much data a particular apc_add()
call can store, separate from the global limit. Something like this:
$m=apc_create_segment('32MB'); // create a segment of memory from the global memory space,
with a cap of 32MB
apc_add('foo','bar',300,$m);
echo apc_fetch('foo');
This would seem to open up a whole new area of optimizations, because then you can put a cap on a
specific variable in your application, that would allow shared memory to be utilized up to a point
while allowing the remainder of the global shared memory to remain free for more critical data to be
stored.
I know apc_inc() and apc_dec() could help me place a cap on the number of times a particular type of
variable could be stored, but this is not satisfactory because 1) the data being stored might be of
variable length, and I'd want a cap on the memory being used rather than the number of values
being stored and 2) there's the overhead of constantly calling apc_inc()/apc_dec() just to keep
track of cache usage.
------------------------------------------------------------------
Alexander Romanovich • alex@whitewhale.net
Technical Director
White Whale Web Services, Inc.