本文整理汇总了C#中CacheItemRemovedReason.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CacheItemRemovedReason.ToString方法的具体用法?C# CacheItemRemovedReason.ToString怎么用?C# CacheItemRemovedReason.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheItemRemovedReason
的用法示例。
在下文中一共展示了CacheItemRemovedReason.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Signal
public void Signal(string key, object value, CacheItemRemovedReason reason)
{
var virtualPath = Convert.ToString(value);
Logger.Debug("Virtual path changed ({1}) '{0}'", virtualPath, reason.ToString());
var token = DetachToken(virtualPath);
if (token != null)
token.IsCurrent = false;
}
示例2: ItemRemovedCallback
internal void ItemRemovedCallback(string key, object value, CacheItemRemovedReason removedReason)
{
try
{
if (Globals.Status == Globals.UpgradeStatus.None)
{
// track data removed from cache to synchonize UrlRule cache
string[] CacheKeys = UrlRuleConfiguration.GetCacheKeys();
if (CacheKeys != null)
{
foreach (string CacheKey in CacheKeys)
{
if (key.Contains(CacheKey))
{
if (DotNetNuke.Entities.Portals.PortalSettings.Current != null)
{
int PortalId = DotNetNuke.Entities.Portals.PortalSettings.Current.PortalId;
Remove(GetCacheKey("UrlRuleConfig" + PortalId));
DnnLog.Trace("Clear cache " + key + " portal "+ PortalId + " raison "+ removedReason.ToString());
}
else
{
// DnnLog.Trace("Clear cache not executed " + key + " raison " + removedReason.ToString());
}
}
}
}
if (key.StartsWith("UrlRuleConfig"))
{
DnnLog.Trace("cache " + key + "claired : " + removedReason.ToString());
}
}
}
catch (Exception exc)
{
//Swallow exception
DnnLog.Error(exc);
}
}
示例3: RootCacheItemRemovedCallback
/// <summary>
/// Called when the root cache item has been removed from the cache
/// </summary>
/// <param name="key">the key of the cache item that wwas removed</param>
/// <param name="value">the value of the cache item that was removed</param>
/// <param name="reason">The <see cref="CacheItemRemovedReason"/> for the removal of the
/// item from the cache</param>
/// <remarks>
/// <para>Since all cache items are dependent on the root cache item, if this method is called,
/// all the cache items for this region have also been removed</para>
/// </remarks>
private void RootCacheItemRemovedCallback(string key, object value, CacheItemRemovedReason reason)
{
if (log.IsDebugEnabled)
{
log.DebugFormat("Cache items for region '{0}' have been removed from the cache for the following reason : {1}",
_name, reason.ToString("g"));
}
//lets us know that we need to reestablish the root cache item for this region
_isRootItemCached = false;
}
示例4: CacheItemRemoved
/// <summary>
/// Invoked when the system removes an execution chain from cache
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <param name="reason">The reason.</param>
public void CacheItemRemoved(string key, Object value, CacheItemRemovedReason reason)
{
WSApplication.Application.Report(Messages.ChainRemoved, key, reason.ToString());
}
示例5: RemovedCallback
public static void RemovedCallback(string k, object v, CacheItemRemovedReason r)
{
Log.TraceLog("★★★★★★Cache中的数据库对象被移除!★★★★★★");
Log.TraceLog("移除的原因为:" + r.ToString());
try
{
if (v != null)
{
if (v is IDbConnection)
{
IDbConnection connection = v as IDbConnection;
if (connection != null)
{
connection.Close();
connection = null;
Log.TraceLog("★★★★★★数据库正常关闭!!!★★★★★★");
}
else
{
Log.TraceLog("★★★★★★数据库已经关闭!!!★★★★★★");
}
}
else
{
Log.TraceLog("★★★★★★数据库已经关闭!!!★★★★★★");
}
}
else
{
Log.TraceLog("★★★★★★不是数据库对象,无法关闭★★★★★★");
}
}
catch (Exception exception)
{
Log.ErrorLog("★★★★★★数据库关闭发生错误!!!★★★★★★");
Log.ErrorLog(exception.Message);
}
}
示例6: RemovedPageIndexCallBack
public void RemovedPageIndexCallBack(string k, object v, CacheItemRemovedReason r)
{
cacheItemRemovedReason = r;
#if (DEBUG)
if (LogRemovedReason)
{
var elc = new EventLogController();
var logValue = new LogInfo { LogTypeKey = "HOST_ALERT" };
string itemName;
string count;
List<string> portalCounts = null;
switch (k)
{
case "DNN_" + PageIndexKey:
itemName = "Page Index";
//user profile actions
try
{
DataCache.RemoveCache(UserProfileActionsKey);
}
catch (ConfigurationErrorsException)
{
//do nothing, this means the web.config file was overwritten, and thus the cache
//was cleared.
}
if (v != null && v.GetType() == typeof(SharedDictionary<string, string>))
{
count = "Item Count: " + ((SharedDictionary<string, string>)v).Values.Count.ToString();
}
else
{
count = "N/a";
}
break;
case "DNN_" + UrlDictKey:
itemName = "Friendly Url List";
if (v != null &&
v.GetType() == typeof(SharedDictionary<int, SharedDictionary<string, string>>))
{
var friendlyUrls = (SharedDictionary<int, SharedDictionary<string, string>>)v;
portalCounts = new List<string>();
using (friendlyUrls.GetReadLock())
{
count = "Portal Count: " + friendlyUrls.Count.ToString();
foreach (int key in friendlyUrls.Keys)
{
SharedDictionary<string, string> portalUrls = friendlyUrls[key];
using (portalUrls.GetReadLock())
{
portalCounts.Add("Portal " + key.ToString() + " Item Count :" + portalUrls.Count.ToString());
}
}
}
}
else
{
count = "N/a";
}
break;
default:
itemName = "Url Rewriter Cache Item";
count = "";
break;
}
//add log values
logValue.AddProperty("Url Rewriting Caching Message", itemName + " Cache item Removed.");
logValue.AddProperty("Reason", cacheItemRemovedReason.ToString());
logValue.AddProperty("Cache Item Key", k);
logValue.AddProperty("Item Count", count);
if (portalCounts != null)
{
int i = 0;
foreach (string item in portalCounts)
{
logValue.AddProperty("Item " + i.ToString(), item);
i++;
}
}
//System.Diagnostics.Trace.Assert(k != null, "k == " + k);
elc.AddLog(logValue);
}
#endif
}
示例7: CacheOnRemove
/// <summary>
/// ����ʧЧ�ص�ί�е�һ��ʵ��,�Ժ�������־��¼
/// </summary>
/// <param name="key"></param>
/// <param name="val"></param>
/// <param name="reason"></param>
public void CacheOnRemove(string Key, object Val, CacheItemRemovedReason Reason)
{
//switch (Reason)
//{
// case CacheItemRemovedReason.DependencyChanged:
// break;
// case CacheItemRemovedReason.Expired:
// {
// break;
// }
// case CacheItemRemovedReason.Removed:
// {
// break;
// }
// case CacheItemRemovedReason.Underused:
// {
// break;
// }
// default: break;
//}
//����Ҫʹ�û�����־,����Ҫʹ���������
//myLogVisitor.WriteLog(this,key,val,reason);
if (this._IsWriteLogs)
{
string logfilepath = Common.Utils.GetMapPath(string.Format("~\\LiteCMSLogs\\{0}.txt", DateTime.Now.ToString("yyMMdd")));
Val = Val == null ? "" : Val.ToString();
string message = string.Format("Key:{0},Value:{1},Reason:{2}", Key, Val, Reason.ToString());
Logs.TinyLogs.InsertLog(logfilepath, DateTime.Now, "Cache_Removed", message);
}
}
示例8: Signal
private void Signal(object value, CacheItemRemovedReason reason)
{
var virtualPath = Convert.ToString(value);
Logger.Debug("虚拟路径发生了变更 ({1}) '{0}'", virtualPath, reason.ToString());
var token = DetachToken(virtualPath);
if (token != null)
token.IsCurrent = false;
}
示例9: LogRemovedItemToAzure
public static void LogRemovedItemToAzure(String key, Object o, CacheItemRemovedReason r)
{
GenUtils.LogMsg("info", "LogRemovedItemToAzure: " + key, r.ToString());
}
示例10: LogRemovedItemToConsole
public static void LogRemovedItemToConsole(String key, Object o, CacheItemRemovedReason r)
{
Console.WriteLine("info: " + key + " " + r.ToString());
}
示例11: Refresh
public void Refresh(string key, object expiredValue, CacheItemRemovedReason removalReason)
{
expiredKeys += key;
expiredValues += expiredValue;
removalReasons += removalReason.ToString();
}
示例12: CacheExpiredEventArgs
/// <summary>
/// Construct cache expire event argument.
/// </summary>
/// <param name="cacheKey">caching key</param>
/// <param name="cacheValue">caching value</param>
/// <param name="reason">cached object removed reason</param>
internal CacheExpiredEventArgs(object cacheKey, object cacheValue, CacheItemRemovedReason reason)
{
this.Key = cacheKey;
this.Value = cacheKey;
this.Reason = (CacheRemovedReason)Enum.Parse(typeof(CacheRemovedReason), reason.ToString());
}
示例13: RemovedCallBack
private void RemovedCallBack(string k, object v, CacheItemRemovedReason r)
{
Logger.Info(k + " : " + r.ToString() + "/" + Environment.StackTrace);
}
示例14: CachedItemRemovedCallback
private void CachedItemRemovedCallback(string key, Object val,
CacheItemRemovedReason reason)
{
//
if (reason == CacheItemRemovedReason.DependencyChanged)
{
// Log the cache key name, reason and time details
// when the cached object was removed from the cache
}
Logger.Debug("Removed item from cache - " + key + " at " + DateTime.Now.ToString() + ". Reason - " + reason.ToString());
}
示例15: SearchCacheItemRemoved
public void SearchCacheItemRemoved(string key, object value, CacheItemRemovedReason reason)
{
LogManager.CurrentLog.AddEntry("Item removed from web cache:\r\n KEY: {0}\r\nREASON: {1}", LogEventType.Information, key, reason.ToString());
}