Changeset 741
- Timestamp:
- 10/21/05 05:35:10
- Files:
-
- trunk/CHANGELOG.txt (modified) (1 diff)
- trunk/cherrypy/lib/filter/sessionfilter.py (modified) (1 diff)
- trunk/docs/book/xml/sessions.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CHANGELOG.txt
r722 r741 1 2005-10-21: 2 * Changed the default value for sessionFilter.locking from "implicit" to "explicit" 3 1 4 2005-10-06: 2 5 * CherryPy-2.1.0-rc2 released trunk/cherrypy/lib/filter/sessionfilter.py
r736 r741 104 104 # Read config options 105 105 sess.sessionTimeout = conf('sessionFilter.timeout', 60) 106 sess.sessionLocking = conf('sessionFilter.locking', ' implicit')106 sess.sessionLocking = conf('sessionFilter.locking', 'explicit') 107 107 sess.onCreateSession = conf('sessionFilter.onCreateSession', 108 108 lambda data: None) trunk/docs/book/xml/sessions.xml
r739 r741 171 171 is serialized. This way, threads can't both modify the data at the same 172 172 time and leave it in an inconsistent state.</para> 173 <para> By default, CherryPy will serialize access to the session data, so173 <para>You can easily make CherryPy serialize access to the session data by setting the <option>sessionFilter.locking</option> config option to <literal>implicit</literal> (the default is <literal>explicit</literal>, which means that CherryPy won't do any locking for you). In the <literal>implicit</literal> mode, 174 174 if a browser makes a second request while a first request is still being 175 175 handled by the server, the second request will block while the first … … 177 177 then the second request will be able to access it.</para> 178 178 <para>This means that the second request will block until the first 179 request is finished. If you're using the <option>ram</option> backend, you 180 can manually shorten the window where the second request will block. This 181 is achieved by having the first request explicitly tell CherryPy when it 182 starts using the session data and when it is finished with it. In order to 183 do so, you have to call <literal>cherrypy.session.acquireLock</literal> 184 and <literal>cherrypy.session.releaseLock</literal>. You also have to set 185 the <literal>sessionFilter.locking</literal> config option to 186 <option>explicit</option>.</para> 187 <para>Note that this technique only works with the <option>ram</option> 188 backend. For other backends like <option>file</option> or 189 <option>postgresql</option>, it is not safe to release the session before 190 the request is finished, because the session data will only be saved at 191 the end of the request anyway. So it would be bad if some other thread 192 started accessing the data between the time when it is released and the 193 time when it is saved.</para> 179 request is finished.</para> 194 180 </section> 195 181 <section id="callbacks">

