NCache 4.6 - Online Documentation

Setting Absolute Expiration with CacheItem

 
In the following example, Absolute Expiration time period is set by assigning it to a property of a CacheItem object in NCache.
 
      To utilize the API, include the following namespace in your application: Alachisoft.NCache.Web.Caching.
 
 
      // Setting Absolute expiration of 5 minutes.
      cacheItem.AbsoluteExpiration = System.DateTime.Now.AddMinutes(5);
 
      try
{
        cache.Add(key, cacheItem, DSWriteOption.None, null);
}
      catch(Exception ex)
{
        // handle exception
}
 
 
See Also