How automatic NDB caching works?

2019-07-17 17:17发布

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条回答
贪生不怕死
2楼-- · 2019-07-17 18:05

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.

查看更多
登录 后发表回答