Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
System.Web.Caching
Cache Class
Cache Fields
 NoSlidingExpiration Field
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
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)

Visual Basic (Declaration)
Public Shared ReadOnly NoSlidingExpiration As TimeSpan
Visual Basic (Usage)
Dim value As TimeSpan

value = Cache.NoSlidingExpiration
C#
public static readonly TimeSpan NoSlidingExpiration
C++
public:
static initonly TimeSpan NoSlidingExpiration
J#
public static final TimeSpan NoSlidingExpiration
JScript
public static final var NoSlidingExpiration : TimeSpan

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
How to: Add Items to the CacheBuilding ASP .NET Web Applications in Visual Studio

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);
   
J#
get_Cache().Insert("DSN", connectionString, null, 
    DateTime.get_Now().AddMinutes(2), 
    System.Web.Caching.Cache.NoSlidingExpiration);

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker