Cache.NoSlidingExpiration Field
Used as the slidingExpiration parameter in an Insert or Add method call to disable sliding expirations. This field is read-only.
[Visual Basic] Public Shared ReadOnly NoSlidingExpiration As TimeSpan [C#] public static readonly TimeSpan NoSlidingExpiration; [C++] public: static TimeSpan NoSlidingExpiration; [JScript] public static var NoSlidingExpiration : TimeSpan;
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
Example
[Visual Basic, C#, C++] The following example demonstrates how to use the Insert method to add an item to the Cache object using the NoSlidingExpiration field.
[Visual Basic] Cache.Insert("DSN", connectionString, Nothing, DateTime.Now.AddMinutes(2), System.Web.Caching.Cache.NoSlidingExpiration) [C#] Cache.Insert("DSN", connectionString, null, DateTime.Now.AddMinutes(2), System.Web.Caching.Cache.NoSlidingExpiration); [C++] Cache->Insert(S"DSN", connectionString, 0, DateTime::Now.AddMinutes(2), System::Web::Caching::Cache::NoSlidingExpiration);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Cache Class | Cache Members | System.Web.Caching Namespace | Zero | Insert