Cache.NoSlidingExpiration Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Used as the slidingExpiration
parameter in an Insert(String, Object) or Add(String, Object, CacheDependency, DateTime, TimeSpan, CacheItemPriority, CacheItemRemovedCallback) method call to disable sliding expirations. This field is read-only.
public: static initonly TimeSpan NoSlidingExpiration;
public static readonly TimeSpan NoSlidingExpiration;
staticval mutable NoSlidingExpiration : TimeSpan
Public Shared ReadOnly NoSlidingExpiration As TimeSpan
Field Value
Examples
The following example demonstrates how to use the Insert method to add an item to the Cache object using the NoSlidingExpiration
field.
Cache.Insert("DSN", connectionString, null, DateTime.Now.AddMinutes(2), System.Web.Caching.Cache.NoSlidingExpiration);
Cache.Insert("DSN", connectionString, Nothing, DateTime.Now.AddMinutes(2), System.Web.Caching.Cache.NoSlidingExpiration)
Remarks
When used, this field sets the slidingExpiration
parameter to the TimeSpan.Zero field, which has a constant value of zero. The cached item expires in accordance with the absoluteExpiration
parameter associated with the Insert
or Add
method call.