Are there any special consideration about @cache.action in production with nginx + uwsgi? I'm having problems using it, so I made a simple test to show you.
In the default welcome application, in default.py controller:
@cache.action(time_expire=30, cache_model=cache.ram, session=False, vars=False, public=True)
def test():
return request.now.strftime('%H:%M:%S')
Now, the first time you hit the /test url, you will see the current time.
But if you inmediately hit the url again, you will see the time shown in the first hit. This time will be shown for 30 seconds, that is, the result of the function is cached for 30 seconds.
This works ok with web2py's embedded server.
However, when I move it to nginx + uwsgi, @cache.action behaves strangely:
1) When I first hit the url, I see the current time.
2) Three seconds after, I hit the url again, and I don't see cached time, instead, I see again the current time.
3) Three or four seconds after, I hit the url again, and I see the first cached time.
4) I keep hitting the url, and it keeps returning previously cached values, randomly. But something is shure: it never returns a value for 30 seconds, the code is executed at least every 4 o 5 seconds. So in a period of 30 seconds, no matter how many times I hit the url, the returned values will always differ 4 o 5 seconds between them.
Am I missing something? Is it necesarry to configure some nginx's stuff? I don't think it would be necessary.