I'll try this out in the next couple of days. Currently, have
side-stepped the callback options from bottlenose, and using web2py
cache the way it was designed to be used.
Thanks for your suggestions, Leonel.
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
On Thu, 08-10-2015 1:16 PM, Leonel Câmara wrote:
The thing is web2py caching logic is different from what bottlenose
wants as it never really returns None, it also never really stores
values directly it calls a function to get a value when it needs one
so you need to make some kind of adapter for it, you were almost there.
I haven't tested it but this should work.
|
defreader(cache_url):
returncache.ram(cache_url,lambda:None,time_expire=None)# Time expire
can be any value you want here (e.g 3600 so bottlenose writes itagain
in an hour)
defwriter(cache_url,response_text):
cache.ram(cache_url,lambda:response_text,time_expire=0)# Time
expire needs to be 0 here to make sure it always writes
amazon =bottlenose.Amazon(CacheWriter=writer,
CacheReader=reader,....)
|
--
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
<mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
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.