React Native + AWS AppSync - 最大数据存储 [英] React Native + AWS AppSync - maximum data storage

查看:59
本文介绍了React Native + AWS AppSync - 最大数据存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个需要存储大约 30,000 条记录的离线应用程序.

I’m building an offline application which needs to store around 30,000 records.

AWS AppSync 是否会对这种规模的数据集产生任何性能问题?

Will AWS AppSync have any performance issues with a data set of this size?

我过去使用过带有 redux-persist 的 redux,它可以离线保存商店,然后在应用启动时重新获取并放置在内存中.这会导致相当大的内存问题,尤其是在查询数据时.

I’ve used redux w/ redux-persist in the past, which saves the store offline, then refetchs and places in memory when the app launches. This causes fairly huge memory issues, especially when querying the data.

我想知道 AppSync 是否能够使用 Realm 或 SQLite 进行离线存储和查询.

I’m wondering if AppSync has the ability to use Realm or SQLite for offline storage and querying.

谢谢.

推荐答案

这是一个老问题,但对于后代:AWS Amplify 的 DataStore 正是这个角色.它在本地处理数据,并在后台处理与 AppSync 的同步.你写的非常简单,简洁的东西是这样的:

This is an old question, but for posterity: AWS Amplify's DataStore fulfills precisely this role. It works with data locally and handles syncing to and from AppSync behind the scenes. You write pretty simple, concise things like this:

// putting data
DataStore.put(new YourModel({ ... });

// getting data
const records = DataStore.query(YourModel);

// getting realtime updates
const subscription = DataStore.observe(YourModel).subscribe(msg => {
  console.log(msg.model, msg.opType, msg.element);
});

DataStore 针对本地存储运行这些查询(其实现因平台而异),在幕后(在线时)为您执行同步和已建立的订阅.

DataStore runs these queries against local storage (implementation of which varies by platform), performs sync's and established subscriptions for you behind the scenes (when online).

请参阅文档以获得更完整的信息信息.

Refer to the docs for more complete information.

这篇关于React Native + AWS AppSync - 最大数据存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆