Export (0) Print
Expand All

Cache.NoSlidingExpiration Field

Used as the slidingExpiration parameter in an Insert or Add method call to disable sliding expirations. This field is read-only.

Namespace: System.Web.Caching
Assembly: System.Web (in system.web.dll)

public static readonly TimeSpan NoSlidingExpiration
public static final TimeSpan NoSlidingExpiration
public static final var NoSlidingExpiration : TimeSpan
Not applicable.

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.

TopicLocation
How to: Add Items to the CacheBuilding ASP .NET Web Applications
How to: Add Items to the CacheBuilding ASP .NET Web Applications

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);
   

get_Cache().Insert("DSN", connectionString, null, 
    DateTime.get_Now().AddMinutes(2), 
    System.Web.Caching.Cache.NoSlidingExpiration);

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft