python - 将 ndb.Tasklets 与 memcache 读取相结合

标签 python google-app-engine app-engine-ndb

假设我想读取以下对象结构,并希望尽可能并行化读取:

root_object --> ShardCounter
            |
             -> SubObject1 (1..N)
            |
             -> SubObject2 (1..N) --> ShardCounter
                                  |
                                   -> SubObject3 (1..N)

1) 与 memcache 和/或存储交互以从 tasklet 中获取 ShardCounters 是否有意义?据我所知,memcache 没有 get_async,所以我有点不确定这是否能很好地并行化?

2) 在为 SubObject2 生成结果的 tasklet 中,我会使用 iter.has_next_async() 模式还是调用 fecth_async()。 map(...) 来检索 SubObject3,或者完全不同的东西(例如,另一个 tasklet)?

感谢您的指点。

最佳答案

NDB 确实在 Context 对象上有自动批处理异步内存缓存 api。参见 https://developers.google.com/appengine/docs/python/ndb/contextclass .

关于python - 将 ndb.Tasklets 与 memcache 读取相结合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9978981/

相关文章:

python - 将 Google App Engine 自定义子域与用户相关联

python - 对任意数量的叠瓦级别进行编码的更优雅的方法

python - 仅当子类重写某些基类方法时才引发?

python - Django 表单不会覆盖以前的条目

google-app-engine - 使用 django non-rel 在 GAE 上不区分大小写的 order_by

django - 如何使用 Google App Engine 进行不区分大小写的过滤器查询?

python - 谷歌应用引擎 NDB : How to store document structure?

google-app-engine - App Engine 上 Cloud Datastore 的客户端库 - NDB 或 google-cloud-datastore

google-app-engine - NDB查询fetch()和ContextOptions

python - 根据另一个 csv 中的另一个值在 csv 列中写入一个值