Field DefaultSliding
A read only field, used to set expiration for cache entry while adding data to cache. Item will be expired from the cache within DefaultSliding value + cache clean up interval, if there is no fetching of that particular item. The value for this field is given from NCache Manager. Minimum value for DefaultSliding expiration is 5s.
Namespace: Alachisoft.NCache.Web.Caching
Assembly: Alachisoft.NCache.Web.dll
Syntax
public static readonly TimeSpan DefaultSliding
Returns
Type | Description |
---|---|
System.TimeSpan |
Examples
The following example demonstrates how to use DefaultSliding to add an item to the cache.
Product product = new Product();
product.ProductID = 1001;
product.ProductName = "Tea";
string key = "Product:" + product.ProductID;
cache.Add(key, product, null, Cache.NoAbsoluteExpiration, Cache.DefaultSliding, CacheItemPriority.Default);