PHP cross-session data

swordfish1

Expert Member
Joined
Apr 10, 2005
Messages
3,304
Reaction score
6
Hi everyone,

I am struggling to find a solution to a simple problem - it is most likely because I don't know what I should search for, but there is the possibility that it is not possible to do what I want :)

I am just looking for pointers to more info on the following:

Is there a way to persist a data structure in PHP, but not as session data, but rather as cross-session data, and preferably not in a file (AFAIK session data is stored in a file), but in memory.

I need this to store hierarchical data which is inefficient to retrieve from the DB on every request and it doesn't change a lot ...

Clearly there are some issues with doing that - like security on shared hosts - in my case it is not a shared host so security is not a problem ... also there is the problem of synchronization - i.e if one request tries to refresh the data structure while another one is trying to access it ... so there need to be a concept of a lock or something ...

anyway, probably I am asking too much ...

if this is not possible (probably it isn't), is there a way to store session data in memory rather than in files? So if you have a large amount of session data you only lose on the memory side, but not on the performance? Well, then is the issue of what happens with the session data if you restart the server ... perhaps, taking into account that the data is not modified often, it can be cached in memory, and only flushed to disk upon modification, and only read in case of a restart?

Any comments are very much appreciated!!!
 
Top
Sign up to the MyBroadband newsletter
X