I've a news site on production running web2py (Version 2.8.2-stable+timestamp.2013.11.28.13.54.07). The site is getting a lot of visits; major part of those visits go to the homepage. In order to optimize the site's homepage, my first step was to cache "the data". So I used selects with cacheable=True in conjunction with cache.ram. This has helped to reduce considerably my server swap and disk I/O (because I'm running on VPS, shared resources).
However, my server is still using "too much" CPU for rendering the homepage. I think is the expected behaviour, as the data is retrieved from the cache, but actually web2py still has to render all that data into the html. So I was wondering if I could use @cache.action with cache_model=cache.ram, so that the html is rendered once every X seconds/minutes. Note that I want the html to be cached server-side, regardless browser-side caching. I tried adding @cache.action(time_expire=300, cache_model=cache.ram, session=False, vars=True, public=True) to the controller function. However, I'm not sure the behaviour is the one I expect, so I have a couple of questions: - How can I verify when the html was actually retrieved from the cache? I tried coding a "print request.now" in the view, but that sentence is executed everytime I hit the site's homepage, so I deduce that the code that generates the html is executed everytime I hit the home instead of retrieving from the cache. However, I'm not sure if that "print request.now" is a correct indicator. - Is it possible to use server-side cache of the view but **not** browser side? I'm specially interested in caching the view server-side, but not browser-side. - Users can login in my site, but homepage isn't different for logged in users, only thing that's different is topbar showing the name of logged in user. Is it still possible to use @cache.action? Thanks in advance. Regards, Lisandro. -- 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.