On Tuesday, May 31, 2016 at 4:24:20 AM UTC-4, Pierre wrote:
>
> I am trying to optimize things: I don't need to store anything in the 
> session so I thought I could apply session.forget() once and that would be 
> true for all  application controllers functions
>

You must call session.forget() sometime during the request for any request 
in which you don't need the session. Of course, that means if you call 
session.forget() in a model, it will affect all requests, because models 
are run on all requests. However, Auth actions require the session, as well 
as pages with forms (the session is used to store the CSRF token) -- so you 
will need some logic to ensure the session is not disabled for all requests.

Also, note that session.forget() won't necessarily lead to a big 
performance boost because when the session remains unchanged during a 
request, it is not saved back out to disk (or the db) anyway. The only 
savings will be from the fact that the session will not need to determine 
whether it has changed (which involves a pickle and hash operation).

Anthony 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to