int cacheOutTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CacheOutTime"]);
List<Student> listModel = new List<Student>();
Cache cache = HttpRuntime.Cache;
string cacheItemMo = "Community";
if (cache[cacheItemMo] == null )
{
listModel = GetList();
cache.Insert(cacheItemMo, listModel, null, DateTime.Now.AddSeconds(cacheOutTime), Cache.NoSlidingExpiration);
}
else
{
listModel = cache[cacheItemMo] as List<Student>;
if (listModel == null )
{
listModel = GetList();
cache.Insert(cacheItemMo, listModel, null, DateTime.Now.AddSeconds(cacheOutTime), Cache.NoSlidingExpiration);
}
}
List<Student> listModel = new List<Student>();
Cache cache = HttpRuntime.Cache;
string cacheItemMo = "Community";
if (cache[cacheItemMo] == null )
{
listModel = GetList();
cache.Insert(cacheItemMo, listModel, null, DateTime.Now.AddSeconds(cacheOutTime), Cache.NoSlidingExpiration);
}
else
{
listModel = cache[cacheItemMo] as List<Student>;
if (listModel == null )
{
listModel = GetList();
cache.Insert(cacheItemMo, listModel, null, DateTime.Now.AddSeconds(cacheOutTime), Cache.NoSlidingExpiration);
}
}