I'd prefer the module option but I need to pass *time_expire* as a variable 
(*db.table.__variableName*), I don't think I can do that in a module can I ?


On Friday, September 15, 2017 at 6:15:44 AM UTC-4, Pierre wrote:
>>
>> 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
>>
>
> You don't necessarily have to put the function in a module -- it can go in 
> a model or even in the controller (if the function takes no arguments, 
> start its name with a double underscore to prevent it from being exposed as 
> an action). You can even define the function inside the controller function 
> that calls it if that's the only place it is needed.
>
> 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.

Reply via email to