Re: Session cache, lock and write
| From: | Yasuo Ohgaki | Date: | Thu, 14 Nov 2013 20:57:02 +0000 |
| Subject: | Re: Session cache, lock and write | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70128@lists.php.net to get a copy of this message | ||
Hi Adam,
On Fri, Nov 15, 2013 at 5:29 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> How do you propose to check if session data was changed? For scalar
>> types it's pretty easy, but it's possible for objects to alter their
>> properties (including the ones they're persisting) on __wakeup() — I
>> presume it would effectively be a comparison of what's about to be
>> written versus what was read initially when it comes time to write the
>> session?
>>
>
> Session data is serialized. If content has changed, the data is changed.
> Session could be large so I'm thinking using md5 hash to save memory.
> Is there any better way?
>
I changed my mind.
Since session data may be cached, it's better to save as it is and compare
byte by byte. Having too large session data is not a good practice anyway.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net