Forgot about that. It's documented here: 
http://web2py.com/books/default/chapter/29/04/the-core?search=lazy_cache#Warning--Do-not-use-the-current-object-in-global-scope-in-a-module.
 
Yes, that would be the way to go if you want to move the function to a 
module.

Anthony

On Friday, September 15, 2017 at 8:15:21 AM UTC-4, Pierre wrote:
>
> the more digging the deeper one gets :
>
>
> https://groups.google.com/forum/?fromgroups#!searchin/web2py/cache$20in$20module/web2py/AZa5Boj3y3E/_BPMTdXwSaMJ
>
> and here is the *cache_this*  module version :
>
> from gluon.cache import lazy_cache
>
> @lazy_cache('data_sample', time_expire=60, cache_model='redis')
> def cache_this():
>     ...
>     rows = db(db.atable.id > 0).select(limitby=limitby, cacheable=True)
>     return rows
>
>
> This seems to do the trick.  Is it 'kosher' ?
>

-- 
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