Re: How best to use php5 objects between pages?

AqD wrote:
On Sep 1, 8:46 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
AqD wrote:
> You can store IDs instead of real objects in session, and have a
> function like "Load_Object_From_Session()" and
> "Save_Object_To_Session()" to operate them - stored in shared memory
> or cache storage (PHP-APC cache can provide this, see

(Top posting fixed)

A very bad idea. Object id's are only unique to the current script -
not across scripts.

An object itself has no ID. It's up to him to decide what the ID
should be (he has to implement the Save/Load functions by himself).
The uniqueness depends on his implementation.

Actually, objects do have resource id's. You just normally don't see them. But I was referring to user-defined id's, based on your previous comments. They are, however, still not unique across sessions.

So now you have multiple objects with the same id
in shared memory.

is not true.

Additionally, you will need to keep some catalog of
what's in shared memory. And using shared memory would be very insecure.

1.He can use APC cache instead of dealing shared memory by himself.
2.Shared memory or APC cache can only be as insecure as data in
session files or databases. It doesn't matter.

Which again is a very bad idea. Session files are relatively secure. APC cache is very insecure.

Plus now you're taking memory from the rest of the system. While it could speed up this application, it can also slow down the entire system, depending on how much you use. You also have to be concerned that the memory gets cleaned up properly (what happens if you put something in it but the user never progresses to the next page?). That requires more work - which cuts into the script performance.

Your answer is not a good one at all. There are many more problems with it than it solves.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.