2014-04-23 20:19:36 +10:00
|
|
|
|
using System;
|
2015-03-31 17:06:13 +11:00
|
|
|
|
using System.Collections.Generic;
|
2013-03-16 08:47:55 +06:00
|
|
|
|
using Umbraco.Core;
|
2014-02-17 17:45:59 +11:00
|
|
|
|
using Umbraco.Core.Events;
|
2013-03-16 08:47:55 +06:00
|
|
|
|
using Umbraco.Core.Models;
|
2014-02-17 17:45:59 +11:00
|
|
|
|
using Umbraco.Core.Models.Membership;
|
|
|
|
|
|
using Umbraco.Core.Persistence.Repositories;
|
2013-02-06 09:53:13 +06:00
|
|
|
|
using Umbraco.Core.Services;
|
2013-02-12 04:13:29 +06:00
|
|
|
|
using umbraco.BusinessLogic;
|
2013-02-06 09:53:13 +06:00
|
|
|
|
using umbraco.cms.businesslogic;
|
|
|
|
|
|
using System.Linq;
|
2013-03-22 00:49:07 +06:00
|
|
|
|
using umbraco.cms.businesslogic.web;
|
2015-07-08 16:54:38 +02:00
|
|
|
|
using Umbraco.Core.Logging;
|
2015-03-30 17:36:54 +11:00
|
|
|
|
using Umbraco.Core.Publishing;
|
2013-07-09 11:47:46 +10:00
|
|
|
|
using Content = Umbraco.Core.Models.Content;
|
2013-07-02 17:47:20 +10:00
|
|
|
|
using ApplicationTree = Umbraco.Core.Models.ApplicationTree;
|
2014-02-17 17:45:59 +11:00
|
|
|
|
using DeleteEventArgs = umbraco.cms.businesslogic.DeleteEventArgs;
|
2013-02-06 09:53:13 +06:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Cache
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2013-02-07 04:45:05 +06:00
|
|
|
|
/// Class which listens to events on business level objects in order to invalidate the cache amongst servers when data changes
|
2013-02-06 09:53:13 +06:00
|
|
|
|
/// </summary>
|
2013-02-07 04:45:05 +06:00
|
|
|
|
public class CacheRefresherEventHandler : ApplicationEventHandler
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
|
|
|
|
|
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
|
2015-07-08 16:54:38 +02:00
|
|
|
|
{
|
|
|
|
|
|
LogHelper.Info<CacheRefresherEventHandler>("Initializing Umbraco internal event handlers for cache refreshing");
|
|
|
|
|
|
|
2013-04-04 21:57:41 +06:00
|
|
|
|
//bind to application tree events
|
2013-07-02 17:47:20 +10:00
|
|
|
|
ApplicationTreeService.Deleted += ApplicationTreeDeleted;
|
|
|
|
|
|
ApplicationTreeService.Updated += ApplicationTreeUpdated;
|
|
|
|
|
|
ApplicationTreeService.New += ApplicationTreeNew;
|
2013-04-04 21:57:41 +06:00
|
|
|
|
|
|
|
|
|
|
//bind to application events
|
2013-07-02 17:47:20 +10:00
|
|
|
|
SectionService.Deleted += ApplicationDeleted;
|
|
|
|
|
|
SectionService.New += ApplicationNew;
|
2013-04-04 21:57:41 +06:00
|
|
|
|
|
2014-01-28 12:13:27 +11:00
|
|
|
|
//bind to user / user type events
|
2014-01-28 09:22:01 +11:00
|
|
|
|
UserService.SavedUserType += UserServiceSavedUserType;
|
|
|
|
|
|
UserService.DeletedUserType += UserServiceDeletedUserType;
|
2014-01-28 12:13:27 +11:00
|
|
|
|
UserService.SavedUser += UserServiceSavedUser;
|
|
|
|
|
|
UserService.DeletedUser += UserServiceDeletedUser;
|
2013-03-22 05:04:32 +06:00
|
|
|
|
|
2013-03-23 01:59:25 +06:00
|
|
|
|
//Bind to dictionary events
|
|
|
|
|
|
|
|
|
|
|
|
LocalizationService.DeletedDictionaryItem += LocalizationServiceDeletedDictionaryItem;
|
|
|
|
|
|
LocalizationService.SavedDictionaryItem += LocalizationServiceSavedDictionaryItem;
|
|
|
|
|
|
|
2013-03-22 05:04:32 +06:00
|
|
|
|
//Bind to data type events
|
|
|
|
|
|
//NOTE: we need to bind to legacy and new API events currently: http://issues.umbraco.org/issue/U4-1979
|
2015-05-18 16:06:22 +10:00
|
|
|
|
|
2013-03-22 05:04:32 +06:00
|
|
|
|
DataTypeService.Deleted += DataTypeServiceDeleted;
|
|
|
|
|
|
DataTypeService.Saved += DataTypeServiceSaved;
|
|
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
//Bind to stylesheet events
|
|
|
|
|
|
|
|
|
|
|
|
FileService.SavedStylesheet += FileServiceSavedStylesheet;
|
|
|
|
|
|
FileService.DeletedStylesheet += FileServiceDeletedStylesheet;
|
2013-03-16 08:47:55 +06:00
|
|
|
|
|
2013-03-22 00:49:07 +06:00
|
|
|
|
//Bind to domain events
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
DomainService.Saved += DomainService_Saved;
|
|
|
|
|
|
DomainService.Deleted += DomainService_Deleted;
|
2013-03-22 00:49:07 +06:00
|
|
|
|
|
2013-03-22 00:35:15 +06:00
|
|
|
|
//Bind to language events
|
|
|
|
|
|
|
|
|
|
|
|
LocalizationService.SavedLanguage += LocalizationServiceSavedLanguage;
|
|
|
|
|
|
LocalizationService.DeletedLanguage += LocalizationServiceDeletedLanguage;
|
|
|
|
|
|
|
2013-03-16 08:47:55 +06:00
|
|
|
|
//Bind to content type events
|
|
|
|
|
|
|
|
|
|
|
|
ContentTypeService.SavedContentType += ContentTypeServiceSavedContentType;
|
|
|
|
|
|
ContentTypeService.SavedMediaType += ContentTypeServiceSavedMediaType;
|
2013-03-21 01:04:27 +06:00
|
|
|
|
ContentTypeService.DeletedContentType += ContentTypeServiceDeletedContentType;
|
|
|
|
|
|
ContentTypeService.DeletedMediaType += ContentTypeServiceDeletedMediaType;
|
2014-01-23 13:33:58 +11:00
|
|
|
|
MemberTypeService.Saved += MemberTypeServiceSaved;
|
|
|
|
|
|
MemberTypeService.Deleted += MemberTypeServiceDeleted;
|
2013-02-12 04:13:29 +06:00
|
|
|
|
|
2013-04-04 00:30:28 +06:00
|
|
|
|
//Bind to permission events
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
//TODO: Wrap legacy permissions so we can get rid of this
|
2013-04-04 00:30:28 +06:00
|
|
|
|
Permission.New += PermissionNew;
|
|
|
|
|
|
Permission.Updated += PermissionUpdated;
|
|
|
|
|
|
Permission.Deleted += PermissionDeleted;
|
2014-02-17 17:45:59 +11:00
|
|
|
|
PermissionRepository<IContent>.AssignedPermissions += CacheRefresherEventHandler_AssignedPermissions;
|
2013-04-04 00:30:28 +06:00
|
|
|
|
|
2013-02-07 05:26:53 +06:00
|
|
|
|
//Bind to template events
|
|
|
|
|
|
|
2013-03-22 02:08:55 +06:00
|
|
|
|
FileService.SavedTemplate += FileServiceSavedTemplate;
|
|
|
|
|
|
FileService.DeletedTemplate += FileServiceDeletedTemplate;
|
2013-02-07 05:26:53 +06:00
|
|
|
|
|
2013-02-07 04:45:05 +06:00
|
|
|
|
//Bind to macro events
|
|
|
|
|
|
|
2013-10-31 17:22:10 +11:00
|
|
|
|
MacroService.Saved += MacroServiceSaved;
|
|
|
|
|
|
MacroService.Deleted += MacroServiceDeleted;
|
2013-02-07 04:45:05 +06:00
|
|
|
|
|
|
|
|
|
|
//Bind to member events
|
2013-02-06 09:53:13 +06:00
|
|
|
|
|
2014-01-23 14:55:41 +11:00
|
|
|
|
MemberService.Saved += MemberServiceSaved;
|
|
|
|
|
|
MemberService.Deleted += MemberServiceDeleted;
|
2014-02-12 17:14:16 +11:00
|
|
|
|
MemberGroupService.Saved += MemberGroupService_Saved;
|
|
|
|
|
|
MemberGroupService.Deleted += MemberGroupService_Deleted;
|
2013-02-06 09:53:13 +06:00
|
|
|
|
|
2013-02-07 04:45:05 +06:00
|
|
|
|
//Bind to media events
|
|
|
|
|
|
|
2014-04-23 20:19:36 +10:00
|
|
|
|
MediaService.Saved += MediaServiceSaved;
|
|
|
|
|
|
MediaService.Deleted += MediaServiceDeleted;
|
|
|
|
|
|
MediaService.Moved += MediaServiceMoved;
|
|
|
|
|
|
MediaService.Trashed += MediaServiceTrashed;
|
|
|
|
|
|
MediaService.EmptiedRecycleBin += MediaServiceEmptiedRecycleBin;
|
2013-07-09 11:47:46 +10:00
|
|
|
|
|
2014-03-06 17:50:08 +11:00
|
|
|
|
//Bind to content events - this is for unpublished content syncing across servers (primarily for examine)
|
2014-04-23 20:28:09 +10:00
|
|
|
|
|
2014-03-06 17:50:08 +11:00
|
|
|
|
ContentService.Saved += ContentServiceSaved;
|
|
|
|
|
|
ContentService.Deleted += ContentServiceDeleted;
|
2013-07-09 11:47:46 +10:00
|
|
|
|
ContentService.Copied += ContentServiceCopied;
|
2014-04-23 20:19:36 +10:00
|
|
|
|
//TODO: The Move method of the content service fires Saved/Published events during its execution so we don't need to listen to moved
|
|
|
|
|
|
//ContentService.Moved += ContentServiceMoved;
|
|
|
|
|
|
ContentService.Trashed += ContentServiceTrashed;
|
2014-04-23 20:28:09 +10:00
|
|
|
|
ContentService.EmptiedRecycleBin += ContentServiceEmptiedRecycleBin;
|
2014-03-27 14:28:45 +11:00
|
|
|
|
|
2015-03-30 17:36:54 +11:00
|
|
|
|
PublishingStrategy.Published += PublishingStrategy_Published;
|
|
|
|
|
|
PublishingStrategy.UnPublished += PublishingStrategy_UnPublished;
|
|
|
|
|
|
|
2014-03-27 14:43:07 +11:00
|
|
|
|
//public access events
|
2015-01-28 13:16:50 +11:00
|
|
|
|
PublicAccessService.Saved += PublicAccessService_Saved;
|
2013-07-09 11:47:46 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-03-30 17:36:54 +11:00
|
|
|
|
#region Publishing
|
|
|
|
|
|
|
|
|
|
|
|
void PublishingStrategy_UnPublished(IPublishingStrategy sender, PublishEventArgs<IContent> e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.PublishedEntities.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.PublishedEntities.Count() > 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var c in e.PublishedEntities)
|
|
|
|
|
|
{
|
|
|
|
|
|
UnPublishSingle(c);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var content = e.PublishedEntities.FirstOrDefault();
|
|
|
|
|
|
UnPublishSingle(content);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Refreshes the xml cache for a single node by removing it
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void UnPublishSingle(IContent content)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RemovePageCache(content);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PublishingStrategy_Published(IPublishingStrategy sender, PublishEventArgs<IContent> e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.PublishedEntities.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.IsAllRepublished)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateEntireCache();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e.PublishedEntities.Count() > 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateMultipleContentCache(e.PublishedEntities);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var content = e.PublishedEntities.FirstOrDefault();
|
|
|
|
|
|
UpdateSingleContentCache(content);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Refreshes the xml cache for all nodes
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void UpdateEntireCache()
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllPageCache();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Refreshes the xml cache for nodes in list
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void UpdateMultipleContentCache(IEnumerable<IContent> content)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshPageCache(content.ToArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Refreshes the xml cache for a single node
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void UpdateSingleContentCache(IContent content)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshPageCache(content);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2014-03-27 14:43:07 +11:00
|
|
|
|
#region Public access event handlers
|
|
|
|
|
|
|
2015-01-28 13:16:50 +11:00
|
|
|
|
static void PublicAccessService_Saved(IPublicAccessService sender, SaveEventArgs<PublicAccessEntry> e)
|
2014-03-27 14:43:07 +11:00
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshPublicAccess();
|
2015-01-28 13:16:50 +11:00
|
|
|
|
}
|
2014-03-27 14:28:45 +11:00
|
|
|
|
|
2014-03-27 14:43:07 +11:00
|
|
|
|
#endregion
|
2014-03-06 17:50:08 +11:00
|
|
|
|
|
2013-07-09 11:47:46 +10:00
|
|
|
|
#region Content service event handlers
|
|
|
|
|
|
|
2014-04-23 20:19:36 +10:00
|
|
|
|
static void ContentServiceEmptiedRecycleBin(IContentService sender, RecycleBinEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.RecycleBinEmptiedSuccessfully && e.IsContentRecycleBin)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RemoveUnpublishedCachePermanently(e.Ids.ToArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Handles cache refreshing for when content is trashed
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// This is for the unpublished page refresher - the entity will be unpublished before being moved to the trash
|
|
|
|
|
|
/// and the unpublished event will take care of remove it from any published caches
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
static void ContentServiceTrashed(IContentService sender, MoveEventArgs<IContent> e)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshUnpublishedPageCache(
|
|
|
|
|
|
e.MoveInfoCollection.Select(x => x.Entity).ToArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-07-09 11:47:46 +10:00
|
|
|
|
/// <summary>
|
2014-04-23 20:19:36 +10:00
|
|
|
|
/// Handles cache refreshing for when content is copied
|
2013-07-09 11:47:46 +10:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2014-03-06 17:50:08 +11:00
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// When an entity is copied new permissions may be assigned to it based on it's parent, if that is the
|
|
|
|
|
|
/// case then we need to clear all user permissions cache.
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
static void ContentServiceCopied(IContentService sender, CopyEventArgs<IContent> e)
|
2013-07-09 11:47:46 +10:00
|
|
|
|
{
|
|
|
|
|
|
//check if permissions have changed
|
|
|
|
|
|
var permissionsChanged = ((Content)e.Copy).WasPropertyDirty("PermissionsChanged");
|
|
|
|
|
|
if (permissionsChanged)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllUserPermissionsCache();
|
|
|
|
|
|
}
|
2014-03-06 17:50:08 +11:00
|
|
|
|
|
2014-04-23 20:19:36 +10:00
|
|
|
|
//run the un-published cache refresher since copied content is not published
|
2014-03-06 17:50:08 +11:00
|
|
|
|
DistributedCache.Instance.RefreshUnpublishedPageCache(e.Copy);
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
2013-04-04 03:43:05 +06:00
|
|
|
|
|
2013-07-09 11:47:46 +10:00
|
|
|
|
/// <summary>
|
2014-03-06 17:50:08 +11:00
|
|
|
|
/// Handles cache refreshing for when content is deleted (not unpublished)
|
2013-07-09 11:47:46 +10:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2014-03-06 17:50:08 +11:00
|
|
|
|
static void ContentServiceDeleted(IContentService sender, DeleteEventArgs<IContent> e)
|
2013-07-09 11:47:46 +10:00
|
|
|
|
{
|
2014-03-06 17:50:08 +11:00
|
|
|
|
DistributedCache.Instance.RemoveUnpublishedPageCache(e.DeletedEntities.ToArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Handles cache refreshing for when content is saved (not published)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// When an entity is saved we need to notify other servers about the change in order for the Examine indexes to
|
|
|
|
|
|
/// stay up-to-date for unpublished content.
|
|
|
|
|
|
///
|
|
|
|
|
|
/// When an entity is created new permissions may be assigned to it based on it's parent, if that is the
|
|
|
|
|
|
/// case then we need to clear all user permissions cache.
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
static void ContentServiceSaved(IContentService sender, SaveEventArgs<IContent> e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var clearUserPermissions = false;
|
|
|
|
|
|
e.SavedEntities.ForEach(x =>
|
|
|
|
|
|
{
|
|
|
|
|
|
//check if it is new
|
|
|
|
|
|
if (x.IsNewEntity())
|
|
|
|
|
|
{
|
|
|
|
|
|
//check if permissions have changed
|
|
|
|
|
|
var permissionsChanged = ((Content)x).WasPropertyDirty("PermissionsChanged");
|
|
|
|
|
|
if (permissionsChanged)
|
|
|
|
|
|
{
|
|
|
|
|
|
clearUserPermissions = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (clearUserPermissions)
|
2013-07-09 11:47:46 +10:00
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllUserPermissionsCache();
|
|
|
|
|
|
}
|
2014-03-06 17:50:08 +11:00
|
|
|
|
|
|
|
|
|
|
//filter out the entities that have only been saved (not newly published) since
|
|
|
|
|
|
// newly published ones will be synced with the published page cache refresher
|
|
|
|
|
|
var unpublished = e.SavedEntities.Where(x => x.JustPublished() == false);
|
|
|
|
|
|
//run the un-published cache refresher
|
|
|
|
|
|
DistributedCache.Instance.RefreshUnpublishedPageCache(unpublished.ToArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-09 11:47:46 +10:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2013-04-04 21:57:41 +06:00
|
|
|
|
#region ApplicationTree event handlers
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ApplicationTreeNew(ApplicationTree sender, EventArgs e)
|
2013-04-04 21:57:41 +06:00
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllApplicationTreeCache();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ApplicationTreeUpdated(ApplicationTree sender, EventArgs e)
|
2013-04-04 21:57:41 +06:00
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllApplicationTreeCache();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ApplicationTreeDeleted(ApplicationTree sender, EventArgs e)
|
2013-04-04 21:57:41 +06:00
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllApplicationTreeCache();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Application event handlers
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ApplicationNew(Section sender, EventArgs e)
|
2013-04-04 21:57:41 +06:00
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllApplicationCache();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ApplicationDeleted(Section sender, EventArgs e)
|
2013-04-04 21:57:41 +06:00
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshAllApplicationCache();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2013-04-04 03:43:05 +06:00
|
|
|
|
#region UserType event handlers
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void UserServiceDeletedUserType(IUserService sender, DeleteEventArgs<IUserType> e)
|
2013-04-04 03:43:05 +06:00
|
|
|
|
{
|
2014-01-28 09:22:01 +11:00
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveUserTypeCache(x.Id));
|
2013-04-04 03:43:05 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void UserServiceSavedUserType(IUserService sender, SaveEventArgs<IUserType> e)
|
2013-04-04 03:43:05 +06:00
|
|
|
|
{
|
2014-01-28 09:22:01 +11:00
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshUserTypeCache(x.Id));
|
2013-04-04 03:43:05 +06:00
|
|
|
|
}
|
2014-01-28 09:22:01 +11:00
|
|
|
|
|
2013-04-04 03:43:05 +06:00
|
|
|
|
#endregion
|
2013-04-04 00:30:28 +06:00
|
|
|
|
|
2013-03-23 01:59:25 +06:00
|
|
|
|
#region Dictionary event handlers
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void LocalizationServiceSavedDictionaryItem(ILocalizationService sender, SaveEventArgs<IDictionaryItem> e)
|
2013-03-23 01:59:25 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshDictionaryCache(x.Id));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void LocalizationServiceDeletedDictionaryItem(ILocalizationService sender, DeleteEventArgs<IDictionaryItem> e)
|
2013-03-23 01:59:25 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveDictionaryCache(x.Id));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2013-03-22 05:04:32 +06:00
|
|
|
|
#region DataType event handlers
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void DataTypeServiceSaved(IDataTypeService sender, SaveEventArgs<IDataTypeDefinition> e)
|
2013-03-22 05:04:32 +06:00
|
|
|
|
{
|
2013-05-07 19:37:57 -10:00
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshDataTypeCache(x));
|
2013-03-22 05:04:32 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void DataTypeServiceDeleted(IDataTypeService sender, DeleteEventArgs<IDataTypeDefinition> e)
|
2013-03-22 05:04:32 +06:00
|
|
|
|
{
|
2013-05-07 19:37:57 -10:00
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveDataTypeCache(x));
|
2013-03-22 05:04:32 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-05-18 16:06:22 +10:00
|
|
|
|
|
2013-03-22 05:04:32 +06:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#region Stylesheet and stylesheet property event handlers
|
2015-01-22 12:17:36 +11:00
|
|
|
|
|
|
|
|
|
|
static void FileServiceDeletedStylesheet(IFileService sender, DeleteEventArgs<Stylesheet> e)
|
2013-03-22 01:49:34 +06:00
|
|
|
|
{
|
2013-03-23 01:59:25 +06:00
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveStylesheetCache(x));
|
2013-03-22 01:49:34 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void FileServiceSavedStylesheet(IFileService sender, SaveEventArgs<Stylesheet> e)
|
2013-03-22 01:49:34 +06:00
|
|
|
|
{
|
2013-03-23 01:59:25 +06:00
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshStylesheetCache(x));
|
2013-03-22 01:49:34 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Domain event handlers
|
2015-01-22 12:17:36 +11:00
|
|
|
|
|
|
|
|
|
|
static void DomainService_Saved(IDomainService sender, SaveEventArgs<IDomain> e)
|
2013-03-22 00:49:07 +06:00
|
|
|
|
{
|
2015-01-22 12:17:36 +11:00
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshDomainCache(x));
|
2013-03-22 00:49:07 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void DomainService_Deleted(IDomainService sender, DeleteEventArgs<IDomain> e)
|
2013-03-22 00:49:07 +06:00
|
|
|
|
{
|
2015-01-22 12:17:36 +11:00
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveDomainCache(x));
|
2013-03-22 00:49:07 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#endregion
|
2013-03-22 00:49:07 +06:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#region Language event handlers
|
2013-03-22 00:35:15 +06:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a langauge is deleted
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void LocalizationServiceDeletedLanguage(ILocalizationService sender, DeleteEventArgs<ILanguage> e)
|
2013-03-22 00:35:15 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveLanguageCache(x));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a langauge is saved
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void LocalizationServiceSavedLanguage(ILocalizationService sender, SaveEventArgs<ILanguage> e)
|
2013-03-22 00:35:15 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshLanguageCache(x));
|
|
|
|
|
|
}
|
2015-01-22 12:17:36 +11:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#endregion
|
2013-03-22 00:35:15 +06:00
|
|
|
|
|
2014-01-23 13:33:58 +11:00
|
|
|
|
#region Content/media/member Type event handlers
|
2013-03-21 01:04:27 +06:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a media type is deleted
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ContentTypeServiceDeletedMediaType(IContentTypeService sender, DeleteEventArgs<IMediaType> e)
|
2013-03-21 01:04:27 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveMediaTypeCache(x));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a content type is deleted
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ContentTypeServiceDeletedContentType(IContentTypeService sender, DeleteEventArgs<IContentType> e)
|
2013-03-21 01:04:27 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.DeletedEntities.ForEach(contentType => DistributedCache.Instance.RemoveContentTypeCache(contentType));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-01-23 13:33:58 +11:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a member type is deleted
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void MemberTypeServiceDeleted(IMemberTypeService sender, DeleteEventArgs<IMemberType> e)
|
2014-01-23 13:33:58 +11:00
|
|
|
|
{
|
|
|
|
|
|
e.DeletedEntities.ForEach(contentType => DistributedCache.Instance.RemoveMemberTypeCache(contentType));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-03-16 08:47:55 +06:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a media type is saved
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ContentTypeServiceSavedMediaType(IContentTypeService sender, SaveEventArgs<IMediaType> e)
|
2013-03-16 08:47:55 +06:00
|
|
|
|
{
|
2013-03-21 08:38:18 +06:00
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshMediaTypeCache(x));
|
2013-03-16 08:47:55 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a content type is saved
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void ContentTypeServiceSavedContentType(IContentTypeService sender, SaveEventArgs<IContentType> e)
|
2013-03-12 22:58:21 +04:00
|
|
|
|
{
|
2013-03-22 01:49:34 +06:00
|
|
|
|
e.SavedEntities.ForEach(contentType => DistributedCache.Instance.RefreshContentTypeCache(contentType));
|
2014-01-23 13:33:58 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fires when a member type is saved
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void MemberTypeServiceSaved(IMemberTypeService sender, SaveEventArgs<IMemberType> e)
|
2014-01-23 13:33:58 +11:00
|
|
|
|
{
|
|
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshMemberTypeCache(x));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2014-02-17 17:45:59 +11:00
|
|
|
|
#region User/permissions event handlers
|
|
|
|
|
|
|
|
|
|
|
|
static void CacheRefresherEventHandler_AssignedPermissions(PermissionRepository<IContent> sender, SaveEventArgs<EntityPermission> e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var userIds = e.SavedEntities.Select(x => x.UserId).Distinct();
|
|
|
|
|
|
userIds.ForEach(x => DistributedCache.Instance.RefreshUserPermissionsCache(x));
|
|
|
|
|
|
}
|
2013-04-04 00:30:28 +06:00
|
|
|
|
|
|
|
|
|
|
static void PermissionDeleted(UserPermission sender, DeleteEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
InvalidateCacheForPermissionsChange(sender);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void PermissionUpdated(UserPermission sender, SaveEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
InvalidateCacheForPermissionsChange(sender);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void PermissionNew(UserPermission sender, NewEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
InvalidateCacheForPermissionsChange(sender);
|
|
|
|
|
|
}
|
2014-01-28 12:13:27 +11:00
|
|
|
|
|
2014-03-06 17:50:08 +11:00
|
|
|
|
static void UserServiceSavedUser(IUserService sender, SaveEventArgs<IUser> e)
|
2013-02-12 04:13:29 +06:00
|
|
|
|
{
|
2014-01-28 12:13:27 +11:00
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshUserCache(x.Id));
|
2013-02-12 04:13:29 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-03-06 17:50:08 +11:00
|
|
|
|
static void UserServiceDeletedUser(IUserService sender, DeleteEventArgs<IUser> e)
|
2013-02-12 04:13:29 +06:00
|
|
|
|
{
|
2014-01-28 12:13:27 +11:00
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveUserCache(x.Id));
|
2013-04-04 00:30:28 +06:00
|
|
|
|
}
|
2014-01-28 12:13:27 +11:00
|
|
|
|
|
2013-04-04 00:30:28 +06:00
|
|
|
|
private static void InvalidateCacheForPermissionsChange(UserPermission sender)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sender.User != null)
|
|
|
|
|
|
{
|
2013-07-09 11:47:46 +10:00
|
|
|
|
DistributedCache.Instance.RefreshUserPermissionsCache(sender.User.Id);
|
2013-04-04 00:30:28 +06:00
|
|
|
|
}
|
2013-07-09 11:47:46 +10:00
|
|
|
|
else if (sender.UserId > -1)
|
2013-04-04 00:30:28 +06:00
|
|
|
|
{
|
2013-07-09 11:47:46 +10:00
|
|
|
|
DistributedCache.Instance.RefreshUserPermissionsCache(sender.UserId);
|
2013-04-04 00:30:28 +06:00
|
|
|
|
}
|
2013-07-09 11:47:46 +10:00
|
|
|
|
else if (sender.NodeIds.Any())
|
2013-04-04 00:30:28 +06:00
|
|
|
|
{
|
2013-07-09 11:47:46 +10:00
|
|
|
|
DistributedCache.Instance.RefreshAllUserPermissionsCache();
|
2013-04-04 00:30:28 +06:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#endregion
|
2013-02-12 04:13:29 +06:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#region Template event handlers
|
2013-03-22 02:08:55 +06:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Removes cache for template
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void FileServiceDeletedTemplate(IFileService sender, DeleteEventArgs<ITemplate> e)
|
2013-03-22 02:08:55 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveTemplateCache(x.Id));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Refresh cache for template
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2015-01-22 12:17:36 +11:00
|
|
|
|
static void FileServiceSavedTemplate(IFileService sender, SaveEventArgs<ITemplate> e)
|
2013-03-22 02:08:55 +06:00
|
|
|
|
{
|
|
|
|
|
|
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshTemplateCache(x.Id));
|
|
|
|
|
|
}
|
2015-01-22 12:17:36 +11:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#endregion
|
2013-02-07 05:26:53 +06:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#region Macro event handlers
|
2013-10-31 17:22:10 +11:00
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
void MacroServiceDeleted(IMacroService sender, DeleteEventArgs<IMacro> e)
|
2013-10-31 17:22:10 +11:00
|
|
|
|
{
|
|
|
|
|
|
foreach (var entity in e.DeletedEntities)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RemoveMacroCache(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-22 12:17:36 +11:00
|
|
|
|
void MacroServiceSaved(IMacroService sender, SaveEventArgs<IMacro> e)
|
2013-10-31 17:22:10 +11:00
|
|
|
|
{
|
|
|
|
|
|
foreach (var entity in e.SavedEntities)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RefreshMacroCache(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-01-22 12:17:36 +11:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#endregion
|
2013-02-07 04:45:05 +06:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#region Media event handlers
|
2014-04-23 20:19:36 +10:00
|
|
|
|
|
|
|
|
|
|
static void MediaServiceEmptiedRecycleBin(IMediaService sender, RecycleBinEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.RecycleBinEmptiedSuccessfully && e.IsMediaRecycleBin)
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RemoveMediaCachePermanently(e.Ids.ToArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void MediaServiceTrashed(IMediaService sender, MoveEventArgs<IMedia> e)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2014-04-23 20:19:36 +10:00
|
|
|
|
DistributedCache.Instance.RemoveMediaCacheAfterRecycling(e.MoveInfoCollection.ToArray());
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-04-23 20:19:36 +10:00
|
|
|
|
static void MediaServiceMoved(IMediaService sender, MoveEventArgs<IMedia> e)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2014-04-23 20:19:36 +10:00
|
|
|
|
DistributedCache.Instance.RefreshMediaCacheAfterMoving(e.MoveInfoCollection.ToArray());
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-04-23 20:19:36 +10:00
|
|
|
|
static void MediaServiceDeleted(IMediaService sender, DeleteEventArgs<IMedia> e)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2014-04-23 20:19:36 +10:00
|
|
|
|
DistributedCache.Instance.RemoveMediaCachePermanently(e.DeletedEntities.Select(x => x.Id).ToArray());
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-03-06 18:25:38 +11:00
|
|
|
|
static void MediaServiceSaved(IMediaService sender, SaveEventArgs<IMedia> e)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2013-02-12 07:35:47 +06:00
|
|
|
|
DistributedCache.Instance.RefreshMediaCache(e.SavedEntities.ToArray());
|
2013-03-22 01:49:34 +06:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2013-02-06 09:53:13 +06:00
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#region Member event handlers
|
2013-10-18 16:23:33 +11:00
|
|
|
|
|
2014-03-06 18:25:38 +11:00
|
|
|
|
static void MemberServiceDeleted(IMemberService sender, DeleteEventArgs<IMember> e)
|
2013-10-18 16:23:33 +11:00
|
|
|
|
{
|
2014-03-06 18:25:38 +11:00
|
|
|
|
DistributedCache.Instance.RemoveMemberCache(e.DeletedEntities.ToArray());
|
2013-10-18 16:23:33 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-03-06 18:25:38 +11:00
|
|
|
|
static void MemberServiceSaved(IMemberService sender, SaveEventArgs<IMember> e)
|
2013-10-18 16:23:33 +11:00
|
|
|
|
{
|
2014-03-06 18:25:38 +11:00
|
|
|
|
DistributedCache.Instance.RefreshMemberCache(e.SavedEntities.ToArray());
|
2013-10-18 16:23:33 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-03-22 01:49:34 +06:00
|
|
|
|
#endregion
|
2014-02-12 17:14:16 +11:00
|
|
|
|
|
|
|
|
|
|
#region Member group event handlers
|
|
|
|
|
|
|
2014-03-06 18:25:38 +11:00
|
|
|
|
static void MemberGroupService_Deleted(IMemberGroupService sender, DeleteEventArgs<IMemberGroup> e)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2014-02-12 17:14:16 +11:00
|
|
|
|
foreach (var m in e.DeletedEntities.ToArray())
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RemoveMemberGroupCache(m.Id);
|
|
|
|
|
|
}
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-03-06 18:25:38 +11:00
|
|
|
|
static void MemberGroupService_Saved(IMemberGroupService sender, SaveEventArgs<IMemberGroup> e)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2014-02-12 17:14:16 +11:00
|
|
|
|
foreach (var m in e.SavedEntities.ToArray())
|
|
|
|
|
|
{
|
|
|
|
|
|
DistributedCache.Instance.RemoveMemberGroupCache(m.Id);
|
|
|
|
|
|
}
|
2013-03-22 01:49:34 +06:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
}
|