Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

42 lines
1.5 KiB
C#

// <copyright file="RemovedCallback.cs" company="Microsoft">
// Copyright (c) 2009 Microsoft Corporation. All rights reserved.
// </copyright>
#if USE_MEMORY_CACHE
using System;
using System.Runtime.Caching;
using System.Web.Util;
namespace System.Web.Caching {
internal sealed class RemovedCallback {
CacheItemRemovedCallback _callback;
internal RemovedCallback(CacheItemRemovedCallback callback) {
_callback = callback;
}
internal void CacheEntryRemovedCallback(CacheEntryRemovedArguments arguments) {
string key = arguments.CacheItem.Key;
object value = arguments.CacheItem.Value;
CacheItemRemovedReason reason;
switch (arguments.RemovedReason) {
case CacheEntryRemovedReason.Removed :
reason = CacheItemRemovedReason.Removed;
break;
case CacheEntryRemovedReason.Expired :
reason = CacheItemRemovedReason.Expired;
break;
case CacheEntryRemovedReason.Evicted :
reason = CacheItemRemovedReason.Underused;
break;
case CacheEntryRemovedReason.ChangeMonitorChanged :
reason = CacheItemRemovedReason.DependencyChanged;
break;
default :
reason = CacheItemRemovedReason.Removed;
break;
}
_callback(key, value, reason);
}
}
}
#endif