Re: How best to use php5 objects between pages?
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sun, 07 Sep 2008 22:14:55 -0400
AqD wrote:
On Sep 5, 7:39 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:AqDwrote:On Sep 2, 8:36 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:Because you obviously don't understand how things work. The userAqDwrote:As I said it's up to the OP to implement an unique ID across sessions.On Sep 1, 8:46 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:Actually, objects do have resource id's. You just normally don't seeAqDwrote:An object itself has no ID. It's up to him to decide what the ID
> 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
>http://www.php.net/manual/en/book.apc.php)
(Top posting fixed)
A very bad idea. Object id's are only unique to the current script -
not across scripts.
should be (he has to implement the Save/Load functions by himself).
The uniqueness depends on his implementation.
them. But I was referring to user-defined id's, based on your previous
comments. They are, however, still not unique across sessions.
I'm NOT telling him the details - but only a direction.
ROFL!Which again is a very bad idea. Session files are relatively secure.So now you have multiple objects with the same idis not true.
in shared memory.
Additionally, you will need to keep some catalog of1.He can use APC cache instead of dealing shared memory by himself.
what's in shared memory. And using shared memory would be very insecure.
2.Shared memory or APC cache can only be as insecure as data in
session files or databases. It doesn't matter.
APC cache is very insecure.
You do know PHP session files are stored as plain text? How could it
be any more secure than APC cache, which is also stored in temp file
in un-encrypted format?
doesn't directly read/write to the session file like he does the APC
cache. Any process can easily screw up the APC cache. It takes work to
do it in the session file.
I didn't say session files were secure. I said APC cache is much less
secure - and I stand by my statement.
So? Why would this be a problem? Any process can write to session
storage too.
If he needs security, he could implement an encryption layer - it's asYes, I do know about APC. And it also uses memory. Plus, you have to
easy as to make one for session.
Plus now you're taking memory from the rest of the system. While it1.Obviously you don't know about APC at all. It uses temp files just
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.
like session.
2.Memory cache systems like memcache always provide some kind of
expiration/cleanup mechanism.
figure out just when to expire the cache. And all kinds of other
things. And BTW - it is also slower than sessions.
Session isn't slower or faster. Session is the API not implemetation.
The point of using cache rather than session and to setup expiration
information etc, is simply because it's more flexible - because it's
not bound by session scope.
And it doesn't have to be APC cache.
In this case, APC cache is a solution looking for a problem.
Then the OP could replace APC cache with other cache systems.
You are so hung up on APC cache that you don't recognize its limitations.Your answer is not a good one at all. There are many more problems withYour opinions on my answer are quite funny :P
it than it solves.
Your "problems" are the problems encountered when somone tries to
implement the cache system by himself - but I'm NOT telling him to do
this. Just pick up some existing cache system - and if it has any of
the problems you mentioned, find another one.
It's true I don't recognize its limitations. But my suggestion is to
tell him to use some cache system. It doesn't have to be APC. And all
the problems you mentioned don't matter.
They don't matter to you because you're so hung up on your cache that you don't recognize the problems and limitations involved.
Sessions are used by millions of programmers - simply because they work so well. I'm not saying they are the end-all to all problems. But they work much better than trying to implement some crazy caching scheme. The code is already built, tested, debugged and working. And it works well.
You can't say the same about caching mechanisms.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- Re: How best to use php5 objects between pages?
- From: Jerry Stuckle
- Re: How best to use php5 objects between pages?
- From: AqD
- Re: How best to use php5 objects between pages?
- From: Jerry Stuckle
- Re: How best to use php5 objects between pages?
- From: AqD
- Re: How best to use php5 objects between pages?
- From: Jerry Stuckle
- Re: How best to use php5 objects between pages?
- From: AqD
- Re: How best to use php5 objects between pages?
- Prev by Date: Re: PHP has encountered an access violation...
- Next by Date: MailEnable and PHP
- Previous by thread: Re: How best to use php5 objects between pages?
- Next by thread: PHP mail being marked as spam
- Index(es):
Relevant Pages
|