Just submitted an issue: https://github.com/web2py/web2py/issues/1355
On Thursday, June 9, 2016 at 2:55:52 PM UTC-4, Anthony wrote: > > Looks like a bug in the Redis cache implementation. cache.action first > saves the output to the cache, and later if it is determined that the HTTP > status is not valid, it then attempts to delete the output from the cache > via cache_model(cache_key, None) > <https://github.com/web2py/web2py/blob/R-2.14.6/gluon/cache.py#L675>. > Passing None as the second argument to one of the cache models is supposed > to delete the key, but this does not work with Redis -- see > https://github.com/web2py/web2py/blob/R-2.14.6/gluon/contrib/redis_cache.py#L152. > > In the Redis cache client, setting the f argument to None only deletes the > key if the object wasn't found in the cache or has expired. We should > probably change the Redis cache to match the behavior of the other cache > models. > > Anthony > > On Thursday, June 9, 2016 at 12:13:51 PM UTC-4, Lisandro wrote: >> >> I'm having trouble to avoid caching pages that returned anything else >> than HTTP 200. >> >> Consider the following simple example: >> >> @cache.action(time_expire=300, cache_model=cache.redis, session=False, >> vars=False, public=True, valid_statuses=[200]) >> def index(): >> raise HTTP(503) >> >> When I hit the URL the first time, I can see in deed a 503 response >> status (I checked headers with Chrome Inspector), and there is nothing >> cached (I checked redis stored keys). >> But the second time I hit the URL, the server returns an HTTP 200 with an >> empty body, and it keeps returning HTTP 200 for the 5 minutes >> (time_expire=300). >> After that time, I hit the URL again, and I can see the HTTP 500. >> >> What am I missing? >> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.