I was trying to use Bottlenose's API (thin wrapper on the Amazon Products
API), alongwith web2py's Cache.
bottlenose: https://github.com/lionheart/bottlenose
Bottlenose provides callbacks where the caching logic can be introduced.
The code is listed below
cache_disk = CacheOnDisk(folder='path...')
cache_ram = CacheInRam()
def write_query_to_db(cache_url, data):
return cache_ram(cache_url, lambda: cache_disk(cache_url, lambda: data,
3600), 60)
# Return None if the key is not present
def read_query_from_db(cache_url):
# How do I read from the cache, the following doesn't seem to work
return cache_ram(cache_url, lambda: cache_disk(cache_url))
amazon = bottlenose.Amazon(CacheWriter=write_query_to_db,
CacheReader=read_query_from_db, ...)
Any suggestions?
Thanks,
Kiran
--
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.