How automatic NDB caching works?

孤街醉人 提交于 2019-12-24 01:15:54

问题


My website is movies catalog. Once user log in, I show him/her the latest movie added to my database:

movies = Movies.query()
movies = movies.order(-Movies.added)
movie = movies.get(keys_only = True) // get_latest_movie_id

Is it cached (movies are added to the database weekly, so it should be cached)? How to verify that (i.e. what is memcache key)? Yesterday about 1000 users visited my site and I've got

OverQuotaError: The API call datastore_v3.RunQuery() required more quota than is available.


回答1:


NDB only caches gets by key. I suspect that in your example code movies is a query, and NDB doesn't cache queries, you'll need to do that yourself.



来源:https://stackoverflow.com/questions/12654159/how-automatic-ndb-caching-works

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