Beaker is used for the session as well as caching (has many different backends, like memcache, memory, file, etc, I'd have to defer you to the Beaker documetnation on that).
I'm no expert with pylons, and my code using beaker is actually a little out of date, but this example from the pylons site seems to cover what I was trying to say decently well: http://pylonshq.com/docs/en/0.9.7/caching/#using-the-cache-object Basically, you want to store your objects primary key in the session, and then do something like: def get_expensive_results_from_sa(): # get your SA results here mycache = cache.get_cache('my_function', type="memory") results = mycache.get_value(key='some_identifier', createfunc= get_expensive_results_from_sa, expiretime=3600) The results will be stored in cache, and created if they expire (and then subsequently stored in cache). I hope this explain it well, let me know if it doesn't. I'm at work and don't have access to test things like this, but I did something very similar where I was building archives of a newspaper from the past 10 years and was caching it for some amount of time, and rebuilding it if it had expired. On Wed, May 12, 2010 at 8:42 AM, writes_on <[email protected]> wrote: > > Hi Brian, > > > Brian O'Connor wrote: > > > > Maybe I'm missing something, but couldn't you store the object in a > > beaker cache that expires and just store the pkid of the object in the > > session? > > > > Thanks for the quick reply. I'm fairly new to Pylons, so I don't think I > understand what you mean by using Beaker. I know Beaker is a caching > mechanism, but I guess I was under the impression it was used for caching > pages, and perhaps for caching the session data. Can you give an example of > using Beaker in the way you describe? > > Thanks again, > Doug > -- > View this message in context: > http://pylons-discuss.1595796.n2.nabble.com/session-individual-object-expiration-tp5037707p5040909.html > Sent from the pylons-discuss mailing list archive at Nabble.com. > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<pylons-discuss%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > > -- Brian O'Connor -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
