RFC: APCIterator class
| From: | shire | Date: | Sun, 29 Jun 2008 18:33:36 +0000 |
| Subject: | RFC: APCIterator class | ||
| Groups: | php.apc.dev | ||
| Request: | Send a blank email to php-apc-dev+get-139@lists.php.net to get a copy of this message | ||
Here is a rough patch of what I have currently in my working copy for an APCIterator class. Check out the tests for some examples but it looks something like:
<?php
$it = new APCIterator('user', $regex, $chunk_size);
foreach($it as $key=>$value) {
echo $key."\n";
}
?>
Some code probably needs to be cleaned up and I need to add a delete() method along with the ability to only dump entry values rather than the full entry info (which it does by default currently). Locking names also conflict with sma.c which I'll need to resolve.
The primary purpose here is to allow iterating large caches in $chunk_size steps, grabbing $chunk_size entries per lock instance so it free's the cache locks for other activity rather than holding up the entire cache to grab the first 100 entries or the first 100 entries matching a regex. Regex is also moved into the C level so it's faster than grabbing all the entries and iterating over them in PHP arrays as is currently required.
-shire
http://tekrat.com/patches/apc_iterator.patch