Re: [APC-DEV] RFC: APCIterator class
[email protected] (Rasmus Lerdorf) Sun, 29 Jun 2008 12:14:48 -0700
| Newsgroups | php.apc.dev |
|---|---|
| Message-ID | <[email protected]> |
The concept looks ok to me. Like you said, a bit of cleanup is needed.
-Rasmus
shire wrote:
> 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
>