Cache would be your best bet! Depending on the size, if you could fit it in
ram that would be awesome, otherwise disk is still fairly fast.
I know you can cache variables using web2py cache.
def create_variable():
mydict = [1,2,3,4,5,...]
return mydict
*variable*=*cache*.ram('key',lambda: create_variable(),3600)
format is
-Thadeus
On Wed, Oct 21, 2009 at 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
-~----------~----~----~----~------~----~------~--~---