在网站中缓存数据 [英] caching data in a website

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

问题描述

我在一个网站中有一个下拉列表,而我的网站中有一个下拉列表,该下拉列表是从数据库绑定的数据.现在,我希望对下拉数据进行缓存,以便当我转到下一页并返回到此页面时,它不应访问数据库.请为此提供一些意见.

I have a dropdown in a website and my website has a dropdown and this drop down is data binded from database. Now I want the dropdown data to be cached so that when I go to next page and come back to this page it should not hit the database. please give some points on this.

推荐答案


使用缓存机制在DropDownList中通用加载数据 [
Hi,
A generic loading of data in a DropDownList using caching mechanism[^]
i hope the above link will help you
thanks
Venkatesh Gudipati


此外,您可以在下面尝试一下,

1)创建一个类,例如DDLCache,它将保存从Db检索到的DDL的初始值.
2)将类型为DDLCache的对象(包含从Db检索到的所有值)存储到Session中.
3)因此,您只需要检查存储到Session中的DDLCache对象是否为null或为空,否则可以从Db中读取.

有关
会话的详细信息 [
In addition, you might try below,

1) Create a Class for example, DDLCache which will hold the initial value for the DDL, retrieved from the Db.
2) Store the object(which contains all the values retrieved from Db ) of type DDLCache into the Session.
3) So then you just need to check if the object of DDLCache stored into Session is null or empty, otherwise read from the Db.

More details about Session[^].

Hope it helps :)


尝试
改进了对ASPX页面上小型列表的快速访问 [
Try
Improved Fast Access to Small Lists On ASPX Pages[^]


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

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