Page 1 of 1

server wide persistant object?

Posted: Sat Mar 06, 2010 12:12 am
by easydev
Hello,

Anyone know is there a way that I can create an object, which persists across different users and sessions? Kind of like system wide global static variable ().

The reason is:
I have a data structure (think of category tree) that once constructed, should only be read only by all users in all sessions. Since constructing this object needs multiple database read, and the values are the same for all users (and it is not sensitive data), I guess it would make sense to construct it only once as "system wide" static object.

The only related method I can think of is: construct it and save it to the session, but this is for one session only, not what I want.

Any idea of it?

Thanks.

Re: server wide persistant object?

Posted: Sat Mar 06, 2010 1:34 pm
by davex
Hi,

Hmm... the only way I can think to do this is to store it something i.e. a database table holding the constructed information which itself only needs one query to return.

Alternatively what about dynamic PHP - write a file containing the object with the data you want as a PHP file then include that into all scripts.

Cheers,

Dave.

Re: server wide persistant object?

Posted: Sat Mar 06, 2010 2:55 pm
by Eran