我正在研究使用 gcloud node api 来访问数据存储 api,但很好奇它是否支持与 ndb 类似的查询缓存?如果没有,确保重复查询被缓存的最佳方法是什么?
3 回答
As far as I know, gcloud-node
isn't planning to be a full-on ORM (like ndb is for Python). Also, as Patrick Costello noted in the comments above, NDB doesn't cache query results, but individual entities instead.
I think if you want caching of query results (or individual entities), you'd have to manually cache these by running your own Memcache server (http://memcached.org/) and interacting with it using memcached (https://www.npmjs.com/package/memcached)
我最终使用了集成到 gstore-node 中的 NsqlCache-datastore。指南:https ://medium.com/google-cloud/how-to-add-a-cache-layer-to-the-google-datastore-in-node-js-ffb402cd0e1c
看起来我可以使用通过此节点库访问的 memcache 应用程序引擎服务: https ://github.com/GoogleCloudPlatform/appengine-nodejs