shared memory examples?
| From: | Phil Glatz | Date: | Sun, 25 Jun 2000 14:35:47 +0000 |
| Subject: | shared memory examples? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2985@lists.php.net to get a copy of this message | ||
Can anyone direct me to a tutorial or example code for using shared memory functions with PHP? I'm able to set/read variables OK, but would like to see how others may be using these functions, and considerations for high-volume production servers.
My ultimate goal is to reduce the load on our database. For example, on an ecommerce site, a query is made of available categories to generate a navigation menu. But this data only changes once every few days. I'd like to do the query, populate a hash array, and save it as a shared memory variable. A request for the array would create a local copy in my PHP code, which I'm assuming would be far more efficient than sending a query out to Oracle. And I'm betting a semaphore will be required when the data is created or updated. A page requesting the hash would check to see if exists, and if not, would trigger a query that would create the data, blocking other requests via a semaphore, right?
Seems like a pretty useful way to reduce database load, so I'm guessing someone has already created a class to do something like this.