NDB Caching When Using Projected Queries

99封情书 提交于 2019-12-01 13:27:46

As far as I'm aware, query results are only cached in in-context cache, but results are not fetched from cache for queries.

key.get() will be cached and retrieved from cache, but query.get() won't be retrieved from cache.

https://developers.google.com/appengine/docs/python/ndb/cache

From the docs: Queries do not look up values in any cache. However, query results are written back to the in-context cache if the cache policy says so (but never to Memcache).

To answer the question regarding what you'll be getting, in both queries it appears that the results will be fetched from the datastore and not from cache.

Projection query results are never cached. It would not be right if a get by key were to ever return a projection result. So no worries.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!