Zeev Suraski wrote:
> I don't think that's the way to do it at all.  In theory, it's no 
> problem to track whether changes were made to the session data, and 
> perform the write at the end of the request, only if we tracked a 
> change.  That's only in theory, though, since with the fancy new 
> $_SESSION array, there's no way to track whether changes were made to 
> the session data.  I can try to think of a solution, though.
> 
> I don't see any advantage in reading the session data, comparing it with 
> the serialized currently-active data, and comparing the two.  It'll 
> probably be slower than simply writing the whole thing all over again.
> 

It could be faster just saving data always.

All depends on situation, session data storage, session data server
loads, size of session data, number of concurrent accesses to servers,
how often session data is changed and so on.

BTW, I don't see strong needs of ommiting write when session data
is not changed. I'm point it out that it can be done, and possibly
faster, with user defined session save handler if one need it.

For my applications, session data is changed often enough. I
don't need the feature omitting session write automatically.

--
Yasuo Ohgaki


> Zeev
> 
> At 04:52 18/08/2002, Yasuo Ohgaki wrote:
> 
>> Rasmus Lerdorf wrote:
>>
>>> Well, I wouldn't call that easy.  To do it in the session handler you
>>> would need to add a bunch of code to the write handler.  It would 
>>> need to
>>> read the current session data, then compare that to the session data it
>>> was called with, and if different write the new session data.  You 
>>> aren't
>>> saving much by doing it at that level.
>>
>>
>> Unserizlied string is returnd from session_read function.
>> We can get MD5 sum of it and save the MD5 sum value.
>> (1 additional line)
>>
>> When session_write function is called serialized session
>> value is passed. We can get MD5 sum of it and compare.
>> If sum differs, save the session data else just leave it.
>> (2 to 3 addtional lines)
>>
>> I'm not sure, but I guess it could be faster than actually
>> saving it always, especially, when multiple web servers share
>> database, etc.
>>
>> I think James is willing to give it a try :)
>>
>> -- 
>> Yasuo Ohgaki
>>
>>> The idea is to support read-only
>>> session requests where the write handler is not called at all when in
>>> read-only mode.
>>> -Rasmus
>>> On Sun, 18 Aug 2002, Yasuo Ohgaki wrote:
>>>
>>>> James E. Flemer wrote:
>>>>
>>>>> Would it be difficult to just add a "dirty" flag somewhere,
>>>>
>>>>
>>>> It's easy.
>>>> Write your own session save handler does this if needed.
>>>>
>>>> -- 
>>>> Yasuo Ohgaki
>>>>
>>>>
>>>> -- 
>>>> PHP Development Mailing List <http://www.php.net/>
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>>
>>
>>
>> -- 
>> PHP Development Mailing List <http://www.php.net/>
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to