thanks Anthony...
looks like the cache select puzzle is now complete. : )
however we still have a 'serious productivity lag here in Bangladesh'...
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code
On Monday, September 18, 2017 at 10:09:51 AM UTC-4, Pierre wrote:
>
> I'd prefer the module option but I need to pass *time_expire* as a
> variable (*db.atable.__variableName*), I don't think I can do that in a
> module can I ?
>
You are not limited to using the decorator to cache the results of
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 row
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,
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
>
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
very True: productivity rules and I am far below modern
standards(more or less the 'Bangladesh level'):)
Le jeudi 14 septembre 2017 16:55:29 UTC+2, Anthony a écrit :
>
>
> Maybe you should have asked a week ago. ;-)
>
> Anthony
>
--
Resources:
- http://web2py.com
- http://web2py.c
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_mode
On Thursday, September 14, 2017 at 9:33:42 AM UTC-4, Pierre wrote:
>
> the cache select mechanism is full of mystery:
>
> given book example code:
>
> def cache_db_select():
> logs = db().select(db.log.ALL, cache=(cache.ram, 60))
> return dict(logs=logs)
>
>
> what happens to next cache_d
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, whic
the cache select mechanism is full of mystery:
given book example code:
def cache_db_select():
logs = db().select(db.log.ALL, cache=(cache.ram, 60))
return dict(logs=logs)
what happens to next cache_db_select call after the 60 seconds has elapsed ?
Does it overwrite the previously cac
11 matches
Mail list logo