This documentation is archived and is not being maintained.

Cache.NoAbsoluteExpiration Field

Used in the absoluteExpiration parameter in an Insert method call to indicate the item should never expire. This field is read-only.

[Visual Basic]
Public Shared ReadOnly NoAbsoluteExpiration As DateTime
[C#]
public static readonly DateTime NoAbsoluteExpiration;
[C++]
public: static DateTime NoAbsoluteExpiration;
[JScript]
public static var NoAbsoluteExpiration : DateTime;

Remarks

When used, this field sets the absoluteExpiration parameter equal to MaxValue, which is a constant representing the largest possible DateTime value, 12/31/9999 11:59:59 PM.

Example

[Visual Basic, C#, C++] The following example demonstrates how to use the NoAbsoluteExpiration field to disable absolute expirations when inserting an item in the Cache.

[Visual Basic] 
Cache.Insert("DSN", connectionString, Nothing, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(10))

[C#] 
Cache.Insert("DSN", connectionString, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(10));


[C++] 
Cache->Insert(S"DSN", connectionString, 0, System::Web::Caching::Cache::NoAbsoluteExpiration, TimeSpan::FromSeconds(10));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter 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 | DateTime | Insert

Show: