Re: Shared hashtable
| From: | Sara Golemon | Date: | Wed, 03 May 2006 16:06:43 +0000 |
| Subject: | Re: Shared hashtable | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23128@lists.php.net to get a copy of this message | ||
> I'm being asked about the possibility of creating an extension that will
> cache some data from a MySQL DB in-memory. I've been reading various
> online resources regarding building extensions and cannot find an answer
> to the following question... Is there a way to create a hashtable in the
> extension which will be available to all of the Apache children without
> resorting to shared memory?
>
You want to *share* something in *memory* between two processes. Yep, ya
pretty much need shared memory...
> It's important that only one instance of the data exists for two
> reasons... 1) It's a fairly large amount of data and 2) it will change as
> the application runs. I've created a small test extension using
> MODULE_GLOBALS the results of which suggest that these variables are per
> process. I'm just looking for some confirmation that shared memory is the
> way to go before I jump down that particular black hole.
>
Yes, Module Globals are per-process (or per-thread if your under a threaded
sapi). In either case, these are specifically designed to *prevent*
concurrent requests from accessing the same data.
-Sara
> TIA.
>
> -Stut