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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---