actually the real function is a little more complex since it returns rows 
plus other datas that don't require caching. I tried to move the cache_this 
function to a module (don't know if this is orthodox) but then i get a 
decorator error:

@current.cache('data_sample', time_expire=60, 
cache_model=current.cache.redis)
attributeError cache object has not attribute redis

Le jeudi 14 septembre 2017 16:49:49 UTC+2, Anthony a écrit :
>
> Looks like you want to cache the results of the entire function -- so why 
> not do that:
>
> @cache(some_key, time_expire=60, cache_model=cache.ram)
> def cache_this():
>     ...
>     rows = db(db.atable.id > 0).select(..., cacheable=True)
>     return dict(rows=rows)
>
> Just be sure to set cacheable=True, which will make the entire Rows object 
> cacheable.
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to