Notice you can set time_expire=None and it will never expire (until
web2py restarts).

On Jul 18, 8:29 am, hcvst <[email protected]> wrote:
> As usual, writing about it, helped:
> This works.
>
> ----
> def db_init():
>      #init db
>      return True
>
> cache.ram('db_init', lambda:db_init(), time_expire=30758400)
> ---
>
> HC
>
> On Jul 18, 3:16 pm, hcvst <[email protected]> wrote:
>
> > Hi,
>
> > I am trying to run a bit of model code only once to init the db. I
> > tried to use cache.ram:
>
> > ---
> > if not cache.ram('db_loaded', lambda:False, time_expire=0):
> >     # do db stuff
> >     cache.ram('db_loaded', lambda:True, time_expire=30758400)
> > #=60*60*24*356
> > ---
>
> > Yet cache.ram always returns False. I executed 'cleanup' from the site
> > admin and restarted
> > web2py a couple of times.
>
> > Why does this not work? Also, would this in principle work on GAE and
> > if so, is cache.ram on GAE emulated as a db lookup and consequently
> > more expensive?
>
> > I would be nice to have some hooks during app installation to perform
> > tasks such as this one.
>
> > Regards,
> > HC
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to