Is NDB query() going through the cache?
NDB docs mention that it will use the cache automatically. Is this only for get_by_id or also for query statements like e.g.:
Product.query().order(Product.name).fetch()
In many pages I’m displaying a Product list that’s why I want it to come from the cache.
Alternative way would be to query the Product list and store in memcache myself, but in this case Product updates will not end up in my ‘manual’ cache. Or would it be an option to store all Product id’s in the cache myself and retrieve them then via memcache/datastore. But this would require a get_by_id which accepts multiple id’s and returns a list..
I had the same problem. Since query is not cached (at least, between diferent contexts, or this is what I understood in docs) I resolved to memcache the querys and keep it synced with my add/update/delete data.
Here was my solution for the problem. I hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With