public static ArrayList NewsList(int id)
{
string cachekey = "NewsList" + id.ToString();
if(HttpRuntime.Cache[cachekey] == null)
{
HttpRuntime.Cache.Insert(cachekey,Test.DAL.NewsList(id),null,DateTime.Now.AddHours(1),TimeSpan.Zero);
}
return (ArrayList)HttpRuntime.Cache[cachekey];
}
上面的编译可以通过下面的为什么不能通过?
public static ArrayList NewsList(int id,out int num)
{
string cachekey = "NewsList" + id.ToString();
if(HttpRuntime.Cache[cachekey] == null)
{
HttpRuntime.Cache.Insert(cachekey,Test.DAL.NewsList(id,out num),null,DateTime.Now.AddHours(1),TimeSpan.Zero);
}
return (ArrayList)HttpRuntime.Cache[cachekey];
}
{
string cachekey = "NewsList" + id.ToString();
if(HttpRuntime.Cache[cachekey] == null)
{
HttpRuntime.Cache.Insert(cachekey,Test.DAL.NewsList(id),null,DateTime.Now.AddHours(1),TimeSpan.Zero);
}
return (ArrayList)HttpRuntime.Cache[cachekey];
}
上面的编译可以通过下面的为什么不能通过?
public static ArrayList NewsList(int id,out int num)
{
string cachekey = "NewsList" + id.ToString();
if(HttpRuntime.Cache[cachekey] == null)
{
HttpRuntime.Cache.Insert(cachekey,Test.DAL.NewsList(id,out num),null,DateTime.Now.AddHours(1),TimeSpan.Zero);
}
return (ArrayList)HttpRuntime.Cache[cachekey];
}
解决方案 »
- 有人碰到过webrequest.timeout设置无效的问题吗?
- return datatable 及Jquery 实现gridview按列排序
- form身份验证
- 怎样使得table里的内容变为动态的?
- 帮我看个UserControl问题,谢谢
- 答对马上结贴,flash和webservice的问题,不会的也来看看
- 思归,孟子e章等高手帮帮忙吧,今天弄不完,明天要被开了,刚学编程一年,让大家见笑了,
- 自定义控件中使用 updatePanel 问题 求高手
- 急,急,急,在线等待
- DataGrid的事件响应的问题(给分300,高手请进)
- 模态窗口如何调用父窗口后台某个方法
- 请高手帮忙,如何用ASP.NET控制上传文件格式呢?
{
num = 0;
string cachekey = "NewsList" + id.ToString();
if(HttpRuntime.Cache[cachekey] == null)
{
HttpRuntime.Cache.Insert(cachekey,Test.DAL.NewsList(id,out num),null,DateTime.Now.AddHours(1),TimeSpan.Zero);
}
return (ArrayList)HttpRuntime.Cache[cachekey];
}
把 num 固定为0了,这个不符合我的要求啊。
没其它办法了吗?
看来不行了。