if (Cache["News"] != null)
{
GridView1.DataSource = Cache["News"] as IList<Model.NewsInfo>;
}
else
{
Cache.Insert("News", News, null, DateTime.Now.AddDays(1),Cache.NoSlidingExpiration, CacheItemPriority.High, null);
GridView1.DataSource = News;
}
GridView1.DataBind();如果 用户新添加一条新闻 其不是要一天才显示出来??? 大家有没有什么好的办法 添加后 立刻显示出来(绑定) 不知道我理解Cache是否有些偏差.大家多提提意见 见人有分
{
GridView1.DataSource = Cache["News"] as IList<Model.NewsInfo>;
}
else
{
Cache.Insert("News", News, null, DateTime.Now.AddDays(1),Cache.NoSlidingExpiration, CacheItemPriority.High, null);
GridView1.DataSource = News;
}
GridView1.DataBind();如果 用户新添加一条新闻 其不是要一天才显示出来??? 大家有没有什么好的办法 添加后 立刻显示出来(绑定) 不知道我理解Cache是否有些偏差.大家多提提意见 见人有分
if(添加成功)
{
//查询数据库并返回数据列表;
Cache["News"]=null;
Cache["News"]=返回的数据列表;
this.DisplayGridData();)
private void DisplayGridData()
{
if (Cache["News"] != null)
{
GridView1.DataSource = Cache["News"] as IList <Model.NewsInfo>;
}
else
{
Cache.Insert("News", News, null, DateTime.Now.AddDays(1),Cache.NoSlidingExpiration, CacheItemPriority.High, null);
GridView1.DataSource = News;
}
GridView1.DataBind();
}