Пример #1
0
        /// <summary>
        /// Handles the ClearCacheTag event of the gCacheTagList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
        protected void gCacheTagList_ClearCacheTag(object sender, RowEventArgs e)
        {
            var definedValueId = e.RowKeyId;
            var definedValue   = DefinedValueCache.Get(definedValueId);

            RockCache.RemoveForTags(definedValue.Value);
            DisplayNotification(nbMessage, string.Format("Removed cached items tagged with \"{0}\".", definedValue.Value), NotificationBoxType.Success);
        }
        protected void btnClearCache_Click(object sender, EventArgs e)
        {
            var checkboxempty = cbl.SelectedValues;

            if (checkboxempty.Count > 0)
            {
                RockCache.RemoveForTags(GetSelectedValues());
                DisplayNotification(nbMessage, string.Format("Removed cached items tagged with \"{0}\".", GetSelectedValues()), NotificationBoxType.Success);
            }
            else
            {
                DisplayNotification(nbMessage, string.Format("No checkbox selected"), NotificationBoxType.Warning);
            }
            Save();
        }
Пример #3
0
        public override bool Execute(RockContext rockContext, WorkflowAction action, object entity, out List <string> errorMessages)
        {
            errorMessages = new List <string>();
            var cacheTagsAttributeValue = GetActionAttributeValue(action, "CacheTags");

            var cacheTags = "";
            //first check to see if is attribute
            var cacheTagsGuid = cacheTagsAttributeValue.AsGuidOrNull();

            if (cacheTagsGuid != null)
            {
                cacheTags = action.GetWorklowAttributeValue(cacheTagsGuid.Value);
            }
            else
            {
                //the value is the cachetags
                cacheTags = cacheTagsAttributeValue;
            }
            RockCache.RemoveForTags(cacheTags);
            action.AddLogEntry("Cleared cache tags: " + cacheTags);

            return(true);
        }