On Wednesday, July 8, 2015 at 12:43:23 PM UTC-4, Dmitry Ermolaev wrote:
>
> @cache.action(time_expire=300, cache_model=cache.ram, quick='SVP')
> it not use response.vars ? why?
>
There is request.vars but no response.vars.
> why I cant store title in cache?
> def contacts():
> response.title=T('some title')
>
You can cache anything you want. However, the @cache decorator only caches
the value returned by the function it is decorating. Notice that your
function does not return the value of response.title -- it merely sets the
value of response.title. If you want that value cached, then you have to
return it from the function. Alternatively, rather than having your
function return a dictionary (which is what will get cached) and *then*
execute the view, you can have your function call response.render() in
order to execute the view itself. The function can then return the rendered
view (which is really just an HTML string value), which is what will get
cached.
Anthony
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.