ASP.NET缓存对象的用法 [英] ASP.NET Cache Object usage

查看:165
本文介绍了ASP.NET缓存对象的用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个aspx页面,我需要加载一个下拉与一些值从DB到来。什么是把数据页面的生命周期中保持价值最正确的地方?

On a aspx page, I have to load a DropDown with some values coming from the DB. What is most correct place to put the data to keep value during the page lifecycle?

Cahce对象吗?
会议?
ViewState的?

Cahce Object? Session? ViewState?

更多细节:


  • 此数据存储的DataTable内

  • 该行可也200

  • 的数据是用来filted的GridView项的所有字符串

推荐答案

缓存如果数据是昂贵的获得,是对所有用户都是相同的。

Cache if the data is expensive to obtain and is the same for all users.

会话如果数据是昂贵获得并取决于用户

Session if the data is expensive to obtain and depends on the user

没什么如果数据是便宜的,得到

Nothing if the data is cheap to obtain.

ViewState中,如果数据在管理页面或某处这里的交通也无所谓(内部网站,很少访问页)。 200行可能是虽然有点太多了。

ViewState if the data is in an admin page or somewhere where the traffic does not matter (internal website, rarely accessed page). 200 rows is probably a bit too much though.

这篇关于ASP.NET缓存对象的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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