I believe I have a fairly typical use case, which is very difficult with eventual consistency. I'm wondering if anyone's already created a python framework to help with this.
I have a GET request that issues a query for a set of entities. They are rarely updated. I have a POST request to update one entity at a time, updating the entity affects whether/how they appear in the GET request.
Since the entities rarely change, I'd like to memcache the GET request for a long time, let's say days or weeks. So on the rare chance I get a POST to update an entity, I can clear memcache.
The problem arises if I handle a POST request, update an entity, clear the cache, and a GET request comes in soon after, the eventually consistent datastore query may yet show the old query results, which will then be memcached for the next few days or weeks.
Instead of simply updating the datastore and clearing the cache, I'll need to:
1. update the datastore
2. get the cached query
3. modify the cached query (with the proper sorting too!)
4. update the cache with the new modified query results (with a cas() operation)
This seems like a common enough problem. Is there any python framework that can help alleviate this problem?
ndb doesn't help, since the datastore queries bypasses all caches.
If it matters, I'm currently using django-nonrel, and django-tastypie handles the GET requests.