Hi,
my goal is to save time at each request processing.

my context is a connection to an Oracle database with unfortunately poor 
network response, so 
in model.py , defining : 
dbo =  DAL(uri , auto_import = False, migrate = False , lazy_tables = False)
on every request it cost time to connect.

So, I decided to save the DAL object in a global variable.
I prefered  doing
current.dbo = dbo
than 
session.dbo = dbo 
in the model file, as it's not user dependent.

and finally store it in the application cache :
current.dbo = cache.ram('dbo', lambda: dbo , time_expire=60*60)

then I only define table in other model/file dedicated to controller in a 
conditional model way.

after test and debug it seems to work well (fell like saving time 
connection) but is it web2py proofed ? 




-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to