Re: [APC-DEV] Re: [PECL-CVS] svn: /pecl/apc/trunk/ apc_cache.c apc_cache.h php_apc.c php_apc.h

[email protected] (Rasmus Lerdorf) Thu, 24 Dec 2009 07:57:24 -0800
Newsgroups php.apc.dev
Message-ID <[email protected]>
shire wrote:
> 
> hrm, yeah I don't think we can get away without the lock here, simply
> because of the (*slot)->next/key type pointer usage.  I believe the
> structure would allow that to be an invalid pointer if it's still in the
> process of being updated, inserted, removed etc.

I guess that is true.  I was thinking even if a slot is deleted, it
would be on the pending list and the *next would still be valid and take
us back into the cache entries, but that is only true if the ref_count
is non-zero, otherwise the entry is destroyed right away.  With the lock
though, apc_exists is only going to be faster than apc_fetch() by a
memcpy (or many memcpys for an array).

-Rasmus