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);
            }
        }
Beispiel #2
0
        /// <inheritdoc/>
        public Attachment GetFinalBaseCard(RefreshActionData actionData)
        {
            var data = new
            {
                count      = actionData.action.data.RefreshCount,
                cardType   = actionData.action.data.CardType,
                cardStatus = FinalCardStatus,
                trigger    = actionData.trigger,
                view       = SharedView,
                message    = "Final Message!"
            };

            var template       = GetCardTemplate(UpdatedBaseCardTemplatePath);
            var serializedJson = template.Expand(data);

            return(CreateAttachment(serializedJson));
        }
        /// <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);
            }
        }
Beispiel #4
0
        /// <inheritdoc/>
        public Attachment GetUpdatedCardForUser(string userMri, RefreshActionData actionData)
        {
            var data = new
            {
                count      = actionData.action.data.RefreshCount,
                userMri    = userMri,
                cardType   = actionData.action.data.CardType,
                cardStatus = UpdatedCardStatus,
                trigger    = actionData.trigger,
                view       = PersonalView,
                message    = "Updated Message!"
            };

            var template       = GetCardTemplate(RefreshSpecificUserViewCardTemplatePath);
            var serializedJson = template.Expand(data);

            return(CreateAttachment(serializedJson));
        }
        /// <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));
            }
        }