当数据不存在安全问题时,使用 JSON 数据比查询数据库更好

发布于 2024-12-29 05:53:18 字数 139 浏览 1 评论 0原文

对于我的新项目,我期待使用 JSON 数据作为文本文件,而不是从数据库中获取数据。我的想法是每当管理员在数据库中创建新条目时,就在服务器上保存一个 JSON 文件。

由于不存在安全问题,这种方法会让用户更快地访问数据,还是应该使用通常的数据库查询。

For my new project I'm looking forward to use JSON data as a text file rather then fetching data from database. My concept is to save a JSON file on the server whenever admin creates a new entry in the database.

As there is no issue of security, will this approach will make user access to data faster or shall I go with the usual database queries.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

氛圍 2025-01-05 05:53:18

JSON 通常用作一种格式化数据的方式,以便将其传输到某个地方。数据库通常用于存储数据。

JSON is typically used as a way to format the data for the purpose of transporting it somewhere. Databases are typically used for storing data.

又怨 2025-01-05 05:53:18

您所描述的可能是完全合理的,但在社区对您的方法发表评论之前,您确实需要对您的项目多说一些。

访问模式是怎样的?它是否始终对用户只读,只能由站点管理员编辑?

您不应该尽早担心性能。更担心开发的难易性、维护性和可靠性,事后可以随时进行优化。

您可能需要查看 http://www.mongodb.org/MongoDB 是一个以文档为中心的存储,使用 JSON 作为其存储格式。

What you've described may be perfectly sensible, but you really need to say a little bit more about your project before the community can comment on your approach.

What's the pattern of access? Is it always read-only for the user, editable only by site administrator for example?

You shouldn't worry about performance early on. Worry more about ease of development, maintenance and reliability, you can always optimise afterwards.

You may want to look at http://www.mongodb.org/. MongoDB is a document-centric store that uses JSON as its storage format.

佼人 2025-01-05 05:53:18

JSON 与 Jquery 结合是一个很棒的快速网页平滑更新选项,但最终它仍然会归结为相同的数据库查询。

只要确保您的查询有效即可。使用存储过程。

JSON 只是数据从服务器(MVC 中的 Web 控制器或标准 C# 中的代码隐藏)发送到客户端(JQuery 或 JavaScript)的方式,

最终将以相同的方式查询数据库。

JSON in combination with Jquery is a great fast web page smooth updating option but ultimately it still will come down to the same database query.

Just make sure your query is efficient. Use a stored proc.

JSON is just the way the data is sent from the server (Web controller in MVC or code behind in standind c#) to the client (JQuery or JavaScript)

Ultimately the database will be queried the same way.

话少情深 2025-01-05 05:53:18

您应该坚持使用经典方法(数据库),因为您将面临并发性和需要处理太多文件的许多问题。

You should stick with the classic method (database), because you'll face many problems with concurrency and with having too many files to handle.

森林迷了鹿 2025-01-05 05:53:18

我认为你应该使用通常的数据库查询。

如果您使用 JSON 文件,则必须将 JSON 文件与数据库同步(这意味着需要额外的工作)并面临 I/O 问题(如果您的站点超级繁忙)。

I think you should go with usual database query.

If you use JSON file you'll have to sync JSON files with the DB (That's mean an extra work is need) and face I/O problems (if your site super busy).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文