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).