我有画表如何缓存用户控件一天
我有画图像
我想同时缓存用户控件一天另一个用户控制的用户控件,它每天用户访问表格的方式,图像将仅在第一次生成并保存到缓存中,并从缓存中全天使用,以便后续访问。
此缓存应该在三个键可以依靠包括登录的用户密钥
我已经写了自定义代码的图像,它工作正常,我保存这些图片的文件夹。这不使用输出缓存。
现在我不知道如何将表存储到一个文件夹,所以我想要使用用户控件的输出缓存来实现缓存表。
我不知道如何缓存一天。
按照指示由Rick添加以下指令的用户控制
<%@ OutputCache Duration="86400" VaryByParam="None" Shared="true"
VaryByControl="Key1;Key2;Key3" %>
写下了下面的代码对消费者页
DashboardControl dc = null;
Control control = (Control)Page.LoadControl(urlBuilder.GetCompleteURL().TrimEnd('?'));
if (control is DashboardControl)
{
dc = control as DashboardControl;
}
else if (control is PartialCachingControl && ((PartialCachingControl)control).CachedControl != null)
{
dc = (DashboardControl)((PartialCachingControl)control).CachedControl;
}
但CachedControl总是给空,任何想法?
请详细说明钥匙。他们是网址的一部分吗? – 2012-01-03 12:42:59
不,它们是会话变量 – 2012-01-03 13:19:38
然后'@ OutputCache'不会工作......剔除Cache对象中的数据。 – 2012-01-05 11:59:49