Beispiel #1
0
        /// <summary>
        /// Invokes the refresh action on a thread pool thread
        /// </summary>
        /// <param name="removedCacheItem">Cache item being removed. Must never be null.</param>
        /// <param name="removalReason">The reason the item was removed.</param>
        /// <param name="instrumentationProvider">The instrumentation provider.</param>
        public static void InvokeRefreshAction(CacheItem removedCacheItem, CacheItemRemovedReason removalReason, ICachingInstrumentationProvider instrumentationProvider)
        {
            if (removedCacheItem == null)
            {
                throw new ArgumentNullException("removedCacheItem");
            }
            if (instrumentationProvider == null)
            {
                throw new ArgumentNullException("instrumentationProvider");
            }

            if (removedCacheItem.RefreshAction == null)
            {
                return;
            }

            try
            {
                RefreshActionData refreshActionData =
                    new RefreshActionData(removedCacheItem.RefreshAction, removedCacheItem.Key, removedCacheItem.Value, removalReason, instrumentationProvider);
                refreshActionData.InvokeOnThreadPoolThread();
            }
            catch (Exception e)
            {
                instrumentationProvider.FireCacheFailed(Resources.FailureToSpawnUserSpecifiedRefreshAction, e);
            }
        }
        /// <summary>
        /// Invokes the refresh action on a thread pool thread
        /// </summary>
        /// <param name="removedCacheItem">Cache item being removed. Must never be null.</param>
        /// <param name="removalReason">The reason the item was removed.</param>	
        /// <param name="instrumentationProvider">The instrumentation provider.</param>
        public static void InvokeRefreshAction(CacheItem removedCacheItem, CacheItemRemovedReason removalReason, CachingInstrumentationProvider instrumentationProvider)
        {
            if (removedCacheItem.RefreshAction == null)
            {
                return;
            }

            try
            {
                RefreshActionData refreshActionData =
                    new RefreshActionData(removedCacheItem.RefreshAction, removedCacheItem.Key, removedCacheItem.Value, removalReason, instrumentationProvider);
                refreshActionData.InvokeOnThreadPoolThread();
            }
            catch (Exception e)
            {
                instrumentationProvider.FireCacheFailed(Resources.FailureToSpawnUserSpecifiedRefreshAction, e);
            }
        }
        /// <summary>
        /// Invokes the refresh action on a thread pool thread
        /// </summary>
        /// <param name="removedCacheItem">Cache item being removed. Must never be null.</param>
        /// <param name="removalReason">The reason the item was removed.</param>
        public static void InvokeRefreshAction(CacheItem removedCacheItem, CacheItemRemovedReason removalReason)
        {
            if (removedCacheItem.RefreshAction == null)
            {
                return;
            }

            try
            {
                RefreshActionData refreshActionData =
                    new RefreshActionData(removedCacheItem.RefreshAction, removedCacheItem.Key, removedCacheItem.Value, removalReason);
                refreshActionData.InvokeOnThreadPoolThread();
            }
            catch (Exception e)
            {
                CachingServiceInternalFailureEvent.Fire(SR.FailureToSpawnUserSpecifiedRefreshAction, e);
            }
            catch
            {
                CachingServiceInternalFailureEvent.Fire(SR.FailureToSpawnUserSpecifiedRefreshAction, new Exception(SR.UnknownFailureReason));
            }
        }
        /// <summary>
        /// Invokes the refresh action on a thread pool thread
        /// </summary>
        /// <param name="removedCacheItem">Cache item being removed. Must never be null.</param>
        /// <param name="removalReason">The reason the item was removed.</param>
        public static void InvokeRefreshAction(CacheItem removedCacheItem, CacheItemRemovedReason removalReason)
        {
            if (removedCacheItem.RefreshAction == null)
            {
                return;
            }

            try
            {
                RefreshActionData refreshActionData =
                    new RefreshActionData(removedCacheItem.RefreshAction, removedCacheItem.Key, removedCacheItem.Value, removalReason);
                refreshActionData.InvokeOnThreadPoolThread();
            }
            catch (Exception e)
            {
                CachingServiceInternalFailureEvent.Fire(SR.FailureToSpawnUserSpecifiedRefreshAction, e);
            }
            catch
            {
                CachingServiceInternalFailureEvent.Fire(SR.FailureToSpawnUserSpecifiedRefreshAction, new Exception(SR.UnknownFailureReason));
            }
        }