将数据本地存储在某个缓存或本地文件中 [英] Storing Data Locally in some Cache or local file

查看:59
本文介绍了将数据本地存储在某个缓存或本地文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发WPF项目,我的数据库位于Amazon Cloud服务器上,

此应用程序可以在有或没有互联网连接的情况下运行(用户也可以进行交易)

我必须在一些临时(或本地)数据库中维护数据,以便它可以在没有互联网的情况下工作。

为此,我使用SQLite,我已经制作了一个SQLite文件,之后每30分钟,我更新两个Database.This工作到现在为止,因为我的数据较少。



现在我必须使用大数据的东西(大约20-30GB或更多),这有什么不妥之处吗?请建议什么应该是本地存储数据的最佳方式?

I am working on a project in WPF, I have its database located on Amazon Cloud server,
This application can run with or without internet connection(Users can do transactions too)
I have to maintain data in some temporary(or local) database so it can work without internet.
For that, I am using SQLite for it, I have made an SQLite file and after every 30 mins, I am updating both Database.This works fine until now,as I was having less data.

Now I have to use the something for Large Data(around 20-30GB or more) ,Is there any alernative thing for this? Kindly suggest what should be the best way to store data locally?

推荐答案

您可以像Sinisa Hajnal建议的那样手动处理 - 我只想指出更多自动方式 - 微软同步框架 - 你考虑过吗?



http://msdn.microsoft.com/de-de/library/bb902854(v=sql.110).aspx [ ^ ]
You could handle this manually like Sinisa Hajnal suggested - I just want to point you to a more "automatic" way - the "Microsoft Sync Framework" - did you consider it?

http://msdn.microsoft.com/de-de/library/bb902854(v=sql.110).aspx[^]


您可以在客户端上拥有完整的数据库并在连接可用时联机工作,而在没有连接时可以脱机,同时同步两者。



重要的一部分是首先尝试发送到服务器,然后在服务器响应后在本地写入数据。如果服务器没有响应,你仍然在本地写入数据,但是标记它以便稍后同步。



每次访问数据库时,你都必须同时处理。每隔一段时间你就可以通过一些快速无害的选择检查连接只是为了看到数据库是可访问的 - 通过在后台执行此操作并将数据库标记为脱机,可以在用户将自己的查询发送到不可用的数据库时为用户节省一些超时。







如果工作集数据小于完整数据库(每个用户或当前事务)或类似的东西) - 您可以在本地编写该数据并使用它,而无需保留完整数据库的当前副本。此版本可以与任何本地存储一起使用。
You could have full blown database on the client and work online while the connection is available and offline when not, while syncing the two.

Important part is to try and send to the server first and then after the response of the server write the data locally. And if the server does not respond you still write the data locally, but flag it for syncing later on.

Each time you access the database you would have to handle both. Every now and then you could check the connection with some quick harmless select just to see the database is accessible - by doing this in the background and marking the database offline you can save the user some timeout waiting when he sends his own queries to unavailable database.



If the working set data is smaller then full database (either per user or current transaction or anything like that) - you can write that data locally and work with that without having to keep current copy of the full database. This version could work with any local storage.


这篇关于将数据本地存储在某个缓存或本地文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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