我应该使用会话/缓存来存储数据集,或者我应该取新鲜从数据库中每一次? [英] Should I use Session/Cache to store the DataSet or should I fetch fresh from the Database each time?

查看:124
本文介绍了我应该使用会话/缓存来存储数据集,或者我应该取新鲜从数据库中每一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编码是进入一个数据集的制作量往往显著。现在,我不知道什么行业标准或最佳实践与来自多个ASP.NET页面数据请求的时候。我应该使用一个缓存/会话,从页面上的数据集传送到网页或者我应该直接从数据库中获取的每一页?

The amount of coding that goes into the making of a DataSet is often significant. Now I'm not sure what the industry standard or best practise when dealing with data requests from multiple ASP.NET pages. Should I use a cache/session to pass on the DataSet from page to page or should I fetch directly from the database for each page?

什么是最常用的方法吗?

What's the most common approach here?

推荐答案

下面是我的想法:

这取决于数据库和数据的,你想获得的类型,还有什么可以修改的数据上。你有没有运行并发你将需要的数据后端进程?难道这只是数据更新,因为当前页面的,还是它在所有更新吗?有多少人要使用所述页?

It depends on the database and the type of data that you're trying to get, as well as what may modify the data. Do you have backend processes that run concurrent with the data you're going to want? Is this data only updated because of the current page, or does it update at all? How many people are going to use said page?

我个人总是打电话到数据库,只是因为有这么多什么,如果当它涉及到这种事情。在任何时候,数据可以改变;因为人们会认为这将是它从来没有为静态。我想任何一天亲自在交易表现正确的数据。

I personally almost always call to the database, simply because there are so many what-ifs when it comes to this kind of thing. At any time the data can change; it's never as static as people would think it would be. I would personally trade correct data over performance any day.

但是,这只是我个人。这个问题是这样开放式的,这是不可能把每一件事情考虑到,因为我不知道你的数据库结构,也不怎么贵也找回它,也没有你使用它什么。

But that's just me personally. This question is so open ended that it's impossible to take every single thing into consideration since I don't know your database structure, nor how expensive it is to retrieve it, nor what you're using it for.

抱歉,我不能真的更多的帮助。

Sorry I couldn't really be more help.

这篇关于我应该使用会话/缓存来存储数据集,或者我应该取新鲜从数据库中每一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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