myvar = cache.ram('myvar',lambda:f(),10**10) where f() is a function that returns the variable.
On Oct 21, 2:43 pm, Mark Larsen <larsen...@gmail.com> wrote: > Let's say I need to create a global variable once on application > start-up. It would take a few CPU cycles to generate this variable so > I wouldn't want to re-generate it on each request cycle. Is there a > way to do this in web2py? Should I be using the cache? > > Thanks, > > Mark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---