Cloud firestore 保留在缓存中多次调用的查询?
Cloud firestore keep in cache queries called several times?
如果我在包装 ListView 的 StreamBuilder 中调用此查询一次,会发生什么情况:
Firestore.instance
.collection('users')
.orderBy('createdAt', descending: true)
.limit(3)
.snapshots();
然后我 运行 再次查询相同的查询,但限制为 6 :
Firestore.instance
.collection('users')
.orderBy('createdAt', descending: true)
.limit(6)
.snapshots();
前 3 个快照是被第二次调用还是保存在缓存中?
StreamBuilder 是否重建所有 ListView?
第二个查询将再次获取所有 6 个文档。 None 其中不会来自缓存,因此它们都将在服务器上按读取计费,并且需要时间来传输。查询结果来自缓存的唯一方式是客户端应用程序处于脱机状态,或者您使用 getDocuments and specify a Source 缓存指定缓存查询源。
如果我在包装 ListView 的 StreamBuilder 中调用此查询一次,会发生什么情况:
Firestore.instance
.collection('users')
.orderBy('createdAt', descending: true)
.limit(3)
.snapshots();
然后我 运行 再次查询相同的查询,但限制为 6 :
Firestore.instance
.collection('users')
.orderBy('createdAt', descending: true)
.limit(6)
.snapshots();
前 3 个快照是被第二次调用还是保存在缓存中? StreamBuilder 是否重建所有 ListView?
第二个查询将再次获取所有 6 个文档。 None 其中不会来自缓存,因此它们都将在服务器上按读取计费,并且需要时间来传输。查询结果来自缓存的唯一方式是客户端应用程序处于脱机状态,或者您使用 getDocuments and specify a Source 缓存指定缓存查询源。