I have a module (in my_app / modules) that defines a class MyClass.
This class operates with model data. In the __init__ there is a heavy
workload, and data are available for other minor calculations.

What I want is to create an instance of MyClass [my_object = MyClass
(...)] a function of my controller and can use this instance from
other functions, to avoid re-do the calculations again.

I analyzed the alternatives are:

1) Save my_object in session. This is discarded because session only
supports saving simple objects.

2) Save my_object with pickle and load it to the other functions.

3) Save the state of the object in the database. I do not like.

4) ¿?

How do you see this approach?
What other alternative can be proposed?

Regards
Jose

Reply via email to