Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
System.Web.Caching
 CacheItemRemovedReason Enumeration
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
CacheItemRemovedReason Enumeration

Specifies the reason an item was removed from the Cache.

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

Visual Basic (Declaration)
Public Enumeration CacheItemRemovedReason
Visual Basic (Usage)
Dim instance As CacheItemRemovedReason
C#
public enum CacheItemRemovedReason
C++
public enum class CacheItemRemovedReason
J#
public enum CacheItemRemovedReason
JScript
public enum CacheItemRemovedReason
 Member nameDescription
DependencyChangedThe item is removed from the cache because the cache dependency associated with it changed. 
ExpiredThe item is removed from the cache because it expired. 
RemovedThe item is removed from the cache by a Remove method call or by an Insert method call that specified the same key. 
UnderusedThe item is removed from the cache because the system removed it to free memory. 

This enumeration is used by the CacheItemRemovedCallback delegate to notify your ASP.NET applications when and why an object was removed from the Cache.

The following code example demonstrates a shared Boolean property, itemRemoved, a shared CacheItemRemovedReason enumeration object, reason, and a CacheItemRemovedCallback delegate, onRemove. The latter can be included in an Insert or Add method call. It also defines a method, RemovedCallback, with a signature that matches the CacheItemRemovedCallback delegate. When the RemovedCallback method is called, it changes the itemRemoved property value to true and assigns the reason property value to the reason provided by the CacheItemRemovedReason enumeration.

Visual Basic
Shared itemRemoved As boolean = false
Shared reason As CacheItemRemovedReason
Dim onRemove As CacheItemRemovedCallback

Public Sub RemovedCallback(k As String, v As Object, r As CacheItemRemovedReason)
  itemRemoved = true
  reason = r
End Sub
C#
static bool itemRemoved = false;
static CacheItemRemovedReason reason;
CacheItemRemovedCallback onRemove = null;

public void RemovedCallback(String k, Object v, CacheItemRemovedReason r){
  itemRemoved = true;
  reason = r;
}
JScript
static var itemRemoved : boolean = false;
static var reason : CacheItemRemovedReason;
var onRemove : CacheItemRemovedCallback = null;

public function RemovedCallback(k : String, v : Object, r : CacheItemRemovedReason){
  itemRemoved = true;
  reason = r;
}

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