Hi Steve,

thanks for the detailed write-up; I see the problem. The current session 
handling is really not ideal when you're using AJAX (which is no wonder 
since Webware has been designed before anybody even thought about that).

IMHO the most simple solution would be to keep a "dirty flag" (set 
whenever __setitem__ or __delitem__ is called for the session) and then 
save the session only when the dirty flag has been set. This will also 
be good for performance. We could also add an AppConfig setting for 
manual saving (False by default to maintain backward compatibility). In 
this case, the dirty flag would not be set automatically, but by calling 
a save() method on the session.

But I'm already seeing a problem with that approach: Since the 
lastAccessTime is stored along with the session, it will not get updated 
if the session is not saved, so the session will expire too early if the 
user does not do anything that alters the session.

We could also keep a "dirty set" instead of a dirty flag. This set would 
contain all keys of the session for which the value has been changed or 
deleted. When the session store saves the session, it would then merge 
the current session values with the dirty set. This would require an 
additional session read operation, though. And it would be a pretty 
substantial change to the current session store(s). I'd rather avoid 
such drastic changes at least for the upcoming 1.1 version.

-- Christoph

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to