Ok, I see...
I would experiment something else then cache.ram.clear() since it seems
invasive and my users fall a couple of time on empty dict or something like
that.
I thought that setting the expire tiem to 0 could be less invasive (I mean
not delete the variable)...
An other thing is that I w
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
I was more asking explanation to Anthony about it suggestion on how to
update cache... I think Martin has find a solution, since that time!
:)
Richard
On Tue, Apr 23, 2013 at 4:22 PM, Derek wrote:
> Why not have a different function create the form, and use a cache
> decorator?
> @cache('crea
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=createE
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 mo
On Thursday, September 27, 2012 1:27:42 PM UTC-4, MichaelF wrote:
>
> By 'cache' do you mean a session variable (or several)? Wouldn't that work?
>
If the stored values are specific to a given user/session, then yes, the
session would be the right place. If they are general values that don't
dep
>
> 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, wh
I think he mean :
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)
Richard
On Thu, Sep 27, 2012 at 1:27 PM, MichaelF wrote:
> By 'cache' do you mean a session variable (or several)? Wouldn't that work
By 'cache' do you mean a session variable (or several)? Wouldn't that work?
On Thursday, September 27, 2012 8:00:59 AM UTC-6, Anthony wrote:
>
> I suppose it depends on whether all the calculations and db accesses are
> needed for the processing as well as the initial creation. If not, you
> cou
I suppose it depends on whether all the calculations and db accesses are
needed for the processing as well as the initial creation. If not, you
could do something like:
if not request.post_vars:
form = a_lot_of_calculations_and_db_accesses()
else:
form = minimal_form_without_all_the_calc
10 matches
Mail list logo