解析.保持 LocalDataStore 数据同步 [英] Parse. Keep LocalDataStore data sync

查看:26
本文介绍了解析.保持 LocalDataStore 数据同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我先在线查询数据(没有[query fromLocalDatastore];").并将其固定"以供本地使用.为了节省带宽,我使用UpdatedAt"来仅获取新内容.

I'm query the data online first(without "[query fromLocalDatastore];"). And "pin' it for local usage. To save bandwidth, i'm using "UpdatedAt" to get only the new stuff.

之后,我使用[query fromLocalDatastore];

After, I query using "[query fromLocalDatastore];

获取数据非常有用.:)

it work great to get datas. :)

但问题是:如何将我的本地数据与从 Parse 仪表板中删除的数据同步?

But the question was: How to sync my local datas with data that are deleted from the Parse dashboard?

例如:获取新东西可以返回零个元素,但是,可能是在线删除了10个元素.

Exemple: Getting new stuff can return zero element, But, maybe they are 10 element deleted online.

最终目标是在分析仪表板中有 10000 行.并只抓取更新或删除的内容(而不是所有内容)

The final goal was to have 10000 rows In parse dashboard. And grab only updated or deleted(instead of all stuff)

推荐答案

在这种情况下,我建议不要使用物理删除,而是使用逻辑删除.添加一个名为已删除"的新布尔列,当您从设备查询时,您将获得所有数据,如果某些内容已被删除,您就会知道.

In this case, I would suggest to not use a physical delete but a logical delete. Add a new Boolean column called "deleted", when you query from the device you'll get all the data and if something has been deleted, you'll know it.

您还应该使用名为sync"的第二列来指示已删除的行已在本地更新,然后使用后台作业(周期性取决于您的需要)以物理方式删除这些行.我认为此操作对于安全清理数据库很重要.如果您将所有已删除的行保留在数据库中,在某些时候您的查询速度可能会受到影响.

You should also use a second column called "sync" to indicate that the deleted row has been updated locally and then use a background job (periodicity depends on your needs) to physically delete those rows. I think this action is important in order to safely clean your database. If you leave all your deleted rows in your database, at some point your queries might get affected in terms of speed.

希望能帮到你.

哈维尔.

这篇关于解析.保持 LocalDataStore 数据同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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