Anyone using persistent object in PHP. for what?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Anyone using persistent object in PHP. for what?

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post 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 :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post 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...).
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

So feyd, you are using these http://php.net/shmop
functions to store in shared memory? Did I get this right?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yup.
Post Reply