What is Absolute and Sliding expiration in .NET?

 Posted by Tripati_tutu on 10/5/2010 | Category: ASP.NET Interview questions | Views: 6556 | Points: 40

These two are Time based expiration strategies.

Absolute Expiration: In this case the Cache expires at a fixed specified date or time.
E.g.: Cache. Insert ("ABC", ds, null, DateTime.Now.AddMinutes (1), Cache.NoSlidingExpiration);
The cache is set to expire exactly two minutes after the user has retrieved the data.

Sliding Expiration: The cache duration increases by the specified sliding expiration value every time the page is requested.
E.g.: Cache.Insert ("ABC", ds, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes (1));
Here ‘ds’ stands for Dataset.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response

More Interview Questions by Tripati_tutu