Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global object regardless of page or session?

Status
Not open for further replies.

xpblueScreenOfDeath

Programmer
Sep 1, 2004
87
I want to make an object that will be global to every PHP page regardless of the user's session. I want the object to stay in memory as any user is accessing any of the pages and stay in memory for at least 30 minutes if no user is browsing any of the pages. Will a singleton accomplish this or is a singleton specific to a single user session? Is there a way to do this in PHP, and if so how? Thanks.
 
Interactions with other scripts will not change values of object's member variables. One purpose would be to cache a set permission to services into memory, so that it doesn't need to be reloaded everytime a user access a page. Then we can use that to authorize or deny a user access to those services. So, lets just there are various items on a page that requires different security levels, so some items I wouldn't even generate if the user doesn't have permission. Or if the user doesn't have access to the page at all(no access to any items) then I would display a access denied. So is that possible?
 
Keep it alive at all times? I suppose if you're running PHP as a web server module, you could extend PHP to do that. But to the best of my knowledge, there is no such functionality in the language already.

Typically, this sort of thing is handled by a value-setting script that is called with every script in a site via include() or require().



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top