自动NDB缓存如何工作? [英] How automatic NDB caching works?
问题描述
movies = Movies.query()
movies = movies.order(-Movies.added)
movie = movies.get(keys_only = True)// get_latest_movie_id
它是否被缓存(电影每周添加到数据库,所以应该被缓存)?如何验证(即什么是memcache密钥)?
昨天大约有1000个用户访问了我的网站,并且我得到了
lockquote
OverQuotaError:API调用datastore_v3.RunQuery()需要更多
quota比可用。
我怀疑你的示例代码 movies
是一个查询,而NDB不会缓存查询,你需要自己去做。
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.
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.
这篇关于自动NDB缓存如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!