存储大量应用程序数据的好方法是什么? [英] What's a good way to store a large amount of application data?

查看:161
本文介绍了存储大量应用程序数据的好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个应用程序,我需要存储数千个对象。现在,我正在使用BinaryFormatter将对象序列化为一个文件,它们与数据文件中的所有对象类型相同,但文件中有数千个对象,因此文件有时会超过500K。问题在于我的应用程序是我需要经常点击这个文件以便保存数据或刷新当前数据但是有明显的延迟。这是一个用C#编写的Windows应用程序,因此延迟是显而易见的。

关键是,我是否可以设置任何优化来改进对文件的访问,还是有更好的方法来存储我的应用程序数据?你们有没有知道关于存储应用程序数据的任何好文章?

谢谢

解决方案

你好


选项1 :根据您存储对象的功能要求,找出其他方法。我认为您需要更改设计。


选项2 :您可以创建用于存储和撤销过程的查找机制。


查找表或所有这些数据源的索引可以保存在内存中。不是将所有对象序列化为一个源,而是使用多个小型源。并继续更新循环中的信息。


退出应用程序之前,您可以序列化此查找表并在每次打开应用程序时收集它。


I've built an application and I need to store thousands of objects. Right now I'm serializing the objects into one file with a BinaryFormatter and they're all the same type of objects that are in the data file but there are thousands of objects in the file so the file can grow well beyond 500K at times. The problem is with my application is that I need to be hitting this file pretty often in order to save data to it or refresh the current data but there is an obvious delay. This is a Windows application written in C# so delays are obvious.

The point is, are there any optimizations that I could set to improve the access to the file or are there any better ways to store my application data? Do any of you know of any good articles on storing application data?

Thanks

解决方案

Hi

        Option 1 : Find out some other way-round depending on your functional requirement for storing objects. I think you require a design change.

        Option 2 :  You can create a look up mechanism for storing and retreival process.

                                        The look up table or the index to all these data sources can be kept in memory. Instead of serializing all the objects to one sources use more than one small sized sources. and keep updating the information in the loop up.

                                         Before exiting your application you can serialize this look up table and gather it every time you open the application.


这篇关于存储大量应用程序数据的好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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