Persistent global data ?

From: Date: Tue, 14 Jan 2003 13:33:02 +0000
Subject: Persistent global data ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131542@lists.php.net to get a copy of this message
Hi all ! I am currently writing some kind of Document/File-Library in a LAMP environment. As the library should be able to handle various file types, and most file types have to be handled differently internally, I would like to use Objects/Classes to make the code for the Library iself independent from the stuff that is individual to the different file types. Now I noticed early that when I use Objects in PHP and have to create many for them each time a script runs it slows the system down considerably. It seems you can now save objects in sessions which AFAIR was not possible last time I tried. But then I would have to read the whole file index (which is actually a tree) into a session variable for each user, and I don't know if thats a good idea performancewise. It would be a rather large multi-dimensional array. So I would like to know if there is any possibility in PHP to create my own persistent superglobal, a variable which can be read by any script running. I think something similiar is available as the "Application" Object in ASP under IIS. I know I have to take care of locking and stuff (although the end-user scripts would only need read access to it), but if I could write some functions which just would check if the tree is already in memory or not (after a server shutdown or whatever), and if not just read it in from the database to make it available in every other script. The only thing I've found so far which I think may be a possibility is the shared memory stuff that PHP supports, but I don't know anything about that on the system level, and its not explained in much detail in the PHP manual. Is that something I should follow, or can't I use it ? Can I somehow use the underlying Apache ? Are there better options ? any help/suggestions/hints are greatly appreciated ! mathias rockel

« previous php.general (#131542) next »