Given PHP5 and Apache, is there any way to share memory between requests? For example, say one web user accesses a page and something - let's call it Jum - gets placed in memory. If another user accesses a page, or the original user sends a second request, can I access Jum? Your first thought may be to use a database, but let's just assume that a database is too slow for the kind of thing I'm trying to do. If there isn't any way to share memory, then I'll resort to a database.
Thanks for any insight,
Graham
Any way to access shared memory from different requests?
Moderator: General Moderators
-
the_drizzle
- Forum Newbie
- Posts: 17
- Joined: Fri Jun 01, 2007 11:55 am
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Here's another link to look at also (I guess I may have been wrong)
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
A database would be more portable in most circumstances, however memcache and shmop are the alternatives.
What is the need behind this? Is it actually necessary for the two users to share the page data? Maybe what you're looking for is something a decent caching system and a template engine can handle or sessions.
What is the need behind this? Is it actually necessary for the two users to share the page data? Maybe what you're looking for is something a decent caching system and a template engine can handle or sessions.
-
the_drizzle
- Forum Newbie
- Posts: 17
- Joined: Fri Jun 01, 2007 11:55 am
Problem Solved
Sorry, I should have been more clear. There is a large list of objects that I wish to share between requests to the server for varying reasons. I suppose I could've discussed several examples but I wanted to avoid digression into how to best implement each feature. In theory I should be able to tackle such tasks on my own
.
I just wanted to investigate all my options before committing myself to a solution. It seems like caching systems are the best way to go. It would be better if I could avoid copying data around so several requests could perform operations on the exact same objects, but I guess PHP doesn't allow for that. Oh well. I think I'll just use a database and put general, intelligent, caching in front of it. Then I'll just set it up so my desired "shared memory" has a high caching priority.
Thanks for your help everyone.
I just wanted to investigate all my options before committing myself to a solution. It seems like caching systems are the best way to go. It would be better if I could avoid copying data around so several requests could perform operations on the exact same objects, but I guess PHP doesn't allow for that. Oh well. I think I'll just use a database and put general, intelligent, caching in front of it. Then I'll just set it up so my desired "shared memory" has a high caching priority.
Thanks for your help everyone.