google app engine - GAE, memcache before DB update -
i have troubles memcache , gae db operations. if update memcache rigth after db operations, x.put(), example, memcache function return old value. if use sleep(), cache more correct, not right, in opinion
sleep(0.2) data = picture.all().order('-created').fetch(300) memcache.set('pictures_all', data) what need do, correct memcache?
answer: need use parent query, picture entities must have same parent, strong consistant results
data = picture.all().order('-created').ancestor(main_key()).fetch(300) memcache.set('pictures_all', data)
if have data, update 1 entry in memcache, no need retrieve memcache. like
data.put() memcache.set(key, data)
Comments
Post a Comment