Google Groups

NDB Caching Question


Richard Arrano Apr 23, 2012 10:21 PM
Posted in group: Google App Engine
Hello,
I'm switching from db to ndb and I have a question regarding caching:

In the old db, I would have a class X that contains a reference to a
class Y. The Y type would be accessed most frequently and rarely
change. So when I would query an X and retrieve the Y type it points
to, I would store X in the memcache with the actual instance Y rather
than the key. If X is invalidated in the memcache, then so is the Y
instance but otherwise I would skip the step of querying Y upon re-
retrieving X from the memcache. Is there any way to do this in ndb? Or
must I re-query each Y type even if it is from memcache or context?

Thanks,
Richard