Just a note - cache gives you more control of data persistence (do you really need to regenerate when logging in/out ? maybe mid-session ? etc). Perhaps even more importantly it allows for pregeneration of data (e.g. on web2py startup).
mdipierro wrote: > I agree with has. You cache when multiple users need to access the > same data. In you case the data is clearly associated to a user hence > it belongs to a session. > > Massimo > > On Jun 29, 10:37 pm, Hans Donner <hans.don...@pobox.com> wrote: > > you should be able to also store the results in a cache. But perhaps > > the session is better in this case > > > > On Tue, Jun 30, 2009 at 2:57 AM, Richard<richar...@gmail.com> wrote: > > > > > do you mean caching the database query? That might help, but > > > constructing the dictionary from the query also takes a lot of > > > operations. > > > > > On Jun 30, 1:11 am, Hans Donner <hans.don...@pobox.com> wrote: > > >> or store the data in cache? > > > > >> On Mon, Jun 29, 2009 at 3:43 PM, cjparsons<cjparso...@yahoo.co.uk> wrote: > > > > >> > Session data is normally stored on disk in the "sessions" folder in > > >> > python pickle format - only the session id is transferred over the > > >> > network connection between the client and the server. (I say > > >> > "normally" because there is also an option to store session data in > > >> > the database, though this has to be enabled). > > > > >> > If you scale your application up to more than one server you'll > > >> > obviously have to consider how the session folder is shared between > > >> > servers, or make sure the same session is always served by the same > > >> > machine. > > > > >> > On Jun 29, 8:10 am, Richard <richar...@gmail.com> wrote: > > >> >> hello, > > > > >> >> I have a Python dictionary that is unique to each user and takes a > > >> >> rather heavy database query to instantiate. Is there a way to maintain > > >> >> the state of this dictionary between requests? For example, is saving > > >> >> it in the session variable a good idea? > > > > >> >> thanks, > > >> >> Richard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---