Property SlidingExpiration
SlidingExpiration
The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.
Declaration
public TimeSpan SlidingExpiration { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan | The default value is Cache.NoSlidingExpiration. |
Remarks
If the slidingExpiration property is set to NoSlidingExpiration,
sliding expiration is disabled. If you set the slidingExpiration
parameter to less than System.TimeSpan.Zero, or the equivalent of
more than one year, an System.ArgumentOutOfRangeException is thrown when you will try to
add or insert the CacheItem.
You cannot set both sliding and absolute expirations on the
same cached item. If you do so, an System.ArgumentException is thrown when you will try to
add or insert the CacheItem.