I'm using dogpile.cache in a Python project, with a pylibmc based backend. After creating a region I use something like:
@region.cache_on_arguments()
def run_some_query(**kwargs):
# ... Query code ...
return query_results
My problem is, that there are certain exceptions that the decorator raises, that I would simply like to ignore. For instance if memcached is not available, or if the result is too large.
Is there a way to achieve this without rolling my own custom decorator? And if I have to create a custom decorator, what is good way to achieve that.
I have managed to solve this problem. As it turns out, the solution was in the dogpile.cache documentation after all, and I missed it. The solution can be found in the section Changing Backend Behavior in the documentation. The idea is simple: create a proxy backend as described in the documentation, and then use the wrap parameter when configuring the region to include this proxy backend.