Page 1 of 1
Anyone using persistent object in PHP. for what?
Posted: Thu Jun 22, 2006 8:44 am
by jmut
Hi there,
Anyone actually using persistent objects in PHP application. I personally thing this is a rather slow process and don't see much benefits.
Are you storing it in $_SESSION or database?
Posted: Thu Jun 22, 2006 8:49 am
by feyd
yes I use them for a lot of things. However, if they are only use specific objects end up in the session data. Everything else is tossed into shared memory. In any given page, I can have as many as 5000 objects floating around pretty easily.
Posted: Thu Jun 22, 2006 9:12 am
by jmut
feyd wrote:yes I use them for a lot of things. However, if they are only use specific objects end up in the session data. Everything else is tossed into shared memory. In any given page, I can have as many as 5000 objects floating around pretty easily.
Can you point a few things you use them for. Is it faster if using them. What is the advantage?
" However, if they are only use specific objects end up in the session data. Everything else is tossed into shared memory." - didnt quite get what you mean

Posted: Thu Jun 22, 2006 9:21 am
by feyd
jmut wrote:Can you point a few things you use them for. Is it faster if using them. What is the advantage?
It's not for speed but efficiency and ease of working with it. Each object understands its data so each object knows how to pack itself into the session or shared memory and unpack itself when needed again.
jmut wrote:" However, if they are only use specific objects end up in the session data. Everything else is tossed into shared memory." - didnt quite get what you mean

Sorry, user specific objects reside in session data but many objects aren't user specific. For those, I throw them into shared memory so that all users have access to it. For instance, the main database interaction object is a global object for the record set it generates when a select query is performed is user (page) specific. If this data should be carried over to other pages, it will be kept in their session while the database object remains in shared memory. The application controller and configuration object resides in shared memory as well while the user's details are kept in their session.
Posted: Thu Jun 22, 2006 9:32 am
by Maugrim_The_Reaper
Means storing data to shared memory rather than the filesystem or a database - I can only assume using something like the Semaphore extension (only ever used it once...shared hosts being shared hosts...).
Posted: Thu Jun 22, 2006 9:38 am
by jmut
So feyd, you are using these
http://php.net/shmop
functions to store in shared memory? Did I get this right?
Posted: Thu Jun 22, 2006 9:40 am
by feyd
yup.