I don't know what you're trying to do, but I was responding to Martin's request, which required doing a lot of processing at form creation time that he didn't want to repeat at processing time -- so the idea was to calculate and cache at form creation time and then read from the cache when the form is submitted/processed. If you are doing something else, then of course this may not make sense for you.
Anthony On Tuesday, April 23, 2013 4:10:38 PM UTC-4, Richard wrote: > > Anthony, > > I maybe wrong, but I am not sure I understand correctly your example > here... Or maybe you suggest this for an other reason... But to me you want > to refresh cash when the form is submit and the value change (since what I > am caching is a dict of id and reprensetnation)... I think it make more > sens like this : > > expire = 3600 if not request.post_vars else 0 > > ?? > > Thanks > > Richard > > > On Thu, Sep 27, 2012 at 2:15 PM, Anthony <abas...@gmail.com > <javascript:>>wrote: > >> var_name = cache.ram('var_name', **lambda: do_something, time_expire=** >>> 3600) >>> >>> You can then clear the cache like this : >>> >>> cache.ram.clear(var_name) >>> >> >> You can also do: >> >> expire = 3600 if request.post_vars else 0 >> var_name = cache.ram('var_name', lambda: do_something, time_expire=expire >> ) >> >> So, when the form is created, time_expire will be 0, which forces the >> value to be refreshed. >> >> Anthony >> >> -- >> >> >> >> > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.