Page 1 of 1

Any way to access shared memory from different requests?

Posted: Mon Jun 04, 2007 5:47 pm
by the_drizzle
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

Posted: Mon Jun 04, 2007 5:58 pm
by RobertGonzalez
I don't PHP can do that.

Posted: Mon Jun 04, 2007 5:59 pm
by volka

Posted: Mon Jun 04, 2007 6:03 pm
by RobertGonzalez
Here's another link to look at also (I guess I may have been wrong)

Posted: Mon Jun 04, 2007 9:20 pm
by Kieran Huggins
have you considered a HEAP table? it would likely have the same-ish performance as what you're after.

Posted: Mon Jun 04, 2007 9:27 pm
by feyd
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.

Problem Solved

Posted: Tue Jun 05, 2007 11:10 am
by the_drizzle
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.