e4c8e36·Author: Mike Bayer·Closed by: Mike Bayer·2014-06-13
Description
I found myself with the problem that I wanted to refresh a cache in the background when I change my SQLAlchemy powered database. I only found ways to use refresh (which delays the client adding/changing data) or invalidate (which delays the client fetching the data). If I wanted to make a seamless transition without anyone having to wait, I'd need a new thread that is spawned right after the session is committed.
I have tested my recipe locally and it works. However, please review if there is a better way (for example it is tailored to cache_on_arguments, there may be a better, more general way).
I found myself with the problem that I wanted to refresh a cache in the background when I change my SQLAlchemy powered database. I only found ways to use
refresh
(which delays the client adding/changing data) orinvalidate
(which delays the client fetching the data). If I wanted to make a seamless transition without anyone having to wait, I'd need a new thread that is spawned right after the session is committed.I have tested my recipe locally and it works. However, please review if there is a better way (for example it is tailored to
cache_on_arguments
, there may be a better, more general way).