Why not have a different function create the form, and use a cache 
decorator?
@cache('createExpensiveForm',time_expire=3600,cache_model=cache.ram)
def createExpensiveForm()
    form = expensive calculations here()
    return form

then your mypage would look like so:

def mypage()
    form=createExpensiveForm()

On Thursday, September 27, 2012 11:15:49 AM UTC-7, Anthony 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.


Reply via email to