Thanks, make sense.

This could use a bit better explanation in the book.

On Feb 10, 9:23 am, Massimo Di Pierro <[email protected]>
wrote:
> The problem is here:
>
> cached = cache.disk(cache_key, lambda:None)
>
> The expiration time is not set by the initial call but it is set but
> each retrieve call. It is the retrieve call above that decided whether
> the stored value should be considered expired or not. Since you are
> not specifying a time expire you get the default 300seconds (5
> minutes) and then you override it the return of lambda:None, i.e.
> None. Should be:
>
> cached = cache.disk(cache_key, lambda:None, None)
>
> On Feb 10, 6:17 am, Dane <[email protected]> wrote:
>
>
>
>
>
>
>
> > I'm trying to use cache.disk to cache a large TABLE object
> > indefinitely. It seems to work fine at first, but then expires after a
> > couple minutes.
>
> > I'm setting it like this:
>
> > cache.disk.clear('^%s$' % cache_key)
> > cache.disk(cache_key, lambda:grid, None)
>
> > *(I also tried 10**10 instead of None for duration with same result)
>
> > And I'm accessing like this:
>
> > cached = cache.disk(cache_key, lambda:None)
> > if cached: return cached
>
> > -Dane

Reply via email to