If the objects are pickleable (serializable), you can store them in a cache (ram, disk, etc.) If you're using a threaded webserver, you can store them in modules, whom persist between requests.
Object instance reuse is not web2py specific, is more a python general issue. Also, bear in mind that if you keep many objects alive, you can run out of memory in some scenarios. You don't need to instantiate the object in each request, you can easily use regular python modules too, and create objects on demand. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Dec 17, 2012 at 9:57 PM, Daniel Gonzalez <[email protected]> wrote: > Hi, > > My application uses some objects which are quite slow to setup. I create > this object in the models file, so that they are available for all > controllers. > > Specifically, most of my processing is delegated to a celery queue (based on > rabbitmq). The interface to this queue is wrapped by a class > (MessageQueueClient) which I instantiate in the model file db.py. If I > understand things correctly, this object will be instantiated for each > request coming to web2py. > > Would it be possible to reuse these objects, so that successive requests do > not need to create them again? How could this be done? > > Thanks, > Daniel > > -- > > > --

