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_db_select call after the 60 seconds has elapsed 
> ?
> Does it overwrite the previously cached rows ?
>

It is just using the web2py caching mechanism, which is described here: 
http://web2py.com/books/default/chapter/29/04/the-core#cache. So, yes, if 
the time has expired, the old cached value will be replaced with a fresh 
value.
 

> One need to know a key in order to clear a specific cached value 
> associated with that key. When performing a cache select no key is being 
> passed so how to clear a specific cached select item (for instance logs) ?
>

If you need to manually clear cached select, you should probably not use 
the above mechanism, as the key used is part of the internal implementation 
(it is the md5 has of the database URI plus the raw SQL query). Instead, 
you should set cacheable=True in the .select() call, and then just cache 
the resulting Rows object using cache.ram() with whatever key you like.
 

> this gives me nerve crises........It should be simple to do a simple thing 
> however one week digging this and I didn't move 1 inch ahead
>
 
Maybe you should have asked a week ago. ;-)

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