[web2py] Re: Persistent variables in web2py

2011-10-31 Thread peter
Massimo I am confused now, in your earlier reply you said 'Web applications must be written without persistent objects. State is share using the database, using sessions and using cache. ' and explained why other kinds of persistence were not possible. So are global variables in modules as good

[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Massimo Di Pierro
As Anthony suggests you can move code to modules and import modules. Module can have global level variables (that do not depend on the user or the request) that will be persistant within the process that imports the module. Database connections anyway, are handled by web2py in an efficient way alr

Re: [web2py] Re: Persistent variables in web2py

2011-10-30 Thread Michele Comitini
If you need distributed caching look at http://memcached.org/. mic Il giorno 30/ott/2011 16:30, "Anthony" ha scritto: > On Sunday, October 30, 2011 11:21:56 AM UTC-4, Ray (a.k.a. Iceberg) wrote: >> >> I guess what he concerns is performance. In other word, "web2py re- >> instantiate all class, v

[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Anthony
On Sunday, October 30, 2011 11:21:56 AM UTC-4, Ray (a.k.a. Iceberg) wrote: > > I guess what he concerns is performance. In other word, "web2py re- > instantiate all class, variables, app logics, etc. ... every time a > page is loaded. Only the stuff in models, and you can reduce that by using c

[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Ray (a.k.a. Iceberg)
Hi Massimo, In the first post of this thread, Arturo said, "Is there a way in web2py to have varibles be persistent. For example when I instantiate a class I don't want to re-instantiate it every time a page is loaded." I guess what he concerns is performance. In other word, "web2py re- instanti

[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Massimo Di Pierro
this is not a web2py issue. This is an issue for all web applications. What if your application is replicated on two server behing a load balancer? The two servers cannot share objects. What if you use a web servers that forks (apache can) than different requests are executed by different processe

Re: [web2py] Re: Persistent variables in web2py

2011-10-30 Thread Michele Comitini
You have persistent connections: just use the pool: it is documented in the book. If you find problems with speed use the profiler that comes with web2py and post here or open a ticket with the results and a model to reproduce those problems, they will be fixed. mic Il giorno 30/ott/2011 15:06, "e

[web2py] Re: Persistent variables in web2py

2011-10-30 Thread evilaliv3
On 30 Ott, 00:39, Massimo Di Pierro wrote: > You must use cache.ram but this is not guaranteed to work. Excuse me Massimo, but, if i understand well this answer, there is no way to have also a persistent connection to the database or a global application variable in web2py? for every request the

[web2py] Re: Persistent variables in web2py

2011-10-29 Thread Massimo Di Pierro
You must use cache.ram but this is not guaranteed to work. In a multi-threaded environment the web server decides which threads to start/stop/kill. On Oct 29, 4:39 pm, Arturo Filastò wrote: > We have noticed that everything in models gets executed every time a > page gets loaded. > > Is there a w