/// <summary> /// Caches the item removed. /// </summary> /// <param name="k">The k.</param> /// <param name="v">The v.</param> /// <param name="r">The r.</param> public static void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { try { if (r == CacheItemRemovedReason.Expired) { // Process the transaction queue on another thread Task.Run(() => DrainTransactionQueue()); // add cache item again AddCallBack(); // call a page on the site to keep IIS alive if (!string.IsNullOrWhiteSpace(Global.BaseUrl)) { string url = Global.BaseUrl + "KeepAlive.aspx"; WebRequest request = WebRequest.Create(url); WebResponse response = request.GetResponse(); } } else { if (r != CacheItemRemovedReason.Removed) { throw new Exception( string.Format("The IISCallBack cache object was removed without expiring. Removed Reason: {0}", r.ConvertToString())); } } } catch (Exception ex) { LogError(ex, null); } }
/// <summary> /// Caches the item removed. /// </summary> /// <param name="k">The k.</param> /// <param name="v">The v.</param> /// <param name="r">The r.</param> public static void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { try { if (r == CacheItemRemovedReason.Expired) { // Process the transaction queue on another thread Task.Run(() => DrainTransactionQueue()); // add cache item again AddCallBack(); var keepAliveUrl = GlobalAttributesCache.Value("KeepAliveUrl"); if (string.IsNullOrWhiteSpace(keepAliveUrl)) { keepAliveUrl = GlobalAttributesCache.Value("InternalApplicationRoot") ?? string.Empty; keepAliveUrl = keepAliveUrl.EnsureTrailingForwardslash() + "KeepAlive.aspx"; } // call a page on the site to keep IIS alive if (!string.IsNullOrWhiteSpace(keepAliveUrl)) { try { WebRequest request = WebRequest.Create(keepAliveUrl); WebResponse response = request.GetResponse(); } catch (Exception ex) { LogError(new Exception("Error doing KeepAlive request.", ex), null); } } } else { if (r != CacheItemRemovedReason.Removed) { throw new Exception( string.Format("The IISCallBack cache object was removed without expiring. Removed Reason: {0}", r.ConvertToString())); } } } catch (Exception ex) { LogError(ex, null); } }
/// <summary> /// Caches the item removed. /// </summary> /// <param name="k">The k.</param> /// <param name="v">The v.</param> /// <param name="r">The r.</param> public static void CacheItemRemoved( string k, object v, CacheItemRemovedReason r ) { try { if ( r == CacheItemRemovedReason.Expired ) { // Process the transaction queue on another thread Task.Run( () => DrainTransactionQueue() ); // add cache item again AddCallBack(); // call a page on the site to keep IIS alive if ( !string.IsNullOrWhiteSpace( Global.BaseUrl ) ) { string url = Global.BaseUrl + "KeepAlive.aspx"; WebRequest request = WebRequest.Create( url ); WebResponse response = request.GetResponse(); } } else { if ( r != CacheItemRemovedReason.Removed ) { throw new Exception( string.Format( "The IISCallBack cache object was removed without expiring. Removed Reason: {0}", r.ConvertToString() ) ); } } } catch ( Exception ex ) { LogError( ex, null ); } }
/// <summary> /// Caches the item removed. /// </summary> /// <param name="k">The k.</param> /// <param name="v">The v.</param> /// <param name="r">The r.</param> public static void CacheItemRemoved( string k, object v, CacheItemRemovedReason r ) { try { if ( r == CacheItemRemovedReason.Expired ) { // Process the transaction queue on another thread Task.Run( () => DrainTransactionQueue() ); // add cache item again AddCallBack(); var keepAliveUrl = GlobalAttributesCache.Value( "KeepAliveUrl" ); if ( string.IsNullOrWhiteSpace( keepAliveUrl ) ) { keepAliveUrl = GlobalAttributesCache.Value( "InternalApplicationRoot" ) ?? string.Empty; keepAliveUrl = keepAliveUrl.EnsureTrailingForwardslash() + "KeepAlive.aspx"; } // call a page on the site to keep IIS alive if ( !string.IsNullOrWhiteSpace( keepAliveUrl ) ) { try { WebRequest request = WebRequest.Create( keepAliveUrl ); WebResponse response = request.GetResponse(); } catch ( Exception ex ) { LogError( new Exception( "Error doing KeepAlive request.", ex ), null ); } } } else { if ( r != CacheItemRemovedReason.Removed ) { throw new Exception( string.Format( "The IISCallBack cache object was removed without expiring. Removed Reason: {0}", r.ConvertToString() ) ); } } } catch ( Exception ex ) { LogError( ex, null ); } }