public async Task Update(ISiteSettings site) { await eventHandlers.HandleSitePreUpdate(site.Id).ConfigureAwait(false); dataProtector.Protect(site); if (site.Id == Guid.Empty) { site.Id = Guid.NewGuid(); await commands.Update(site, CancellationToken.None); } else { await commands.Update(site, CancellationToken.None); } if (multiTenantOptions.Mode == MultiTenantMode.FolderName) { if (string.IsNullOrEmpty(site.SiteFolderName)) { cacheHelper.ClearCache("root"); } else { cacheHelper.ClearCache(site.SiteFolderName); } } else { if (_context != null && !string.IsNullOrEmpty(_context.Request.Host.Value)) { cacheHelper.ClearCache(_context.Request.Host.Value); } } await eventHandlers.HandleSiteUpdated(site).ConfigureAwait(false); }
public async Task Update(ISiteSettings site) { dataProtector.Protect(site); if (site.Id == 0) { await commands.Update(site, CancellationToken.None); } else { await commands.Update(site, CancellationToken.None); } if (multiTenantOptions.Mode == MultiTenantMode.FolderName) { if (string.IsNullOrEmpty(site.SiteFolderName)) { cacheHelper.ClearCache("root"); } else { cacheHelper.ClearCache(site.SiteFolderName); } } else { if (_context != null && !string.IsNullOrEmpty(_context.Request.Host.Value)) { cacheHelper.ClearCache(_context.Request.Host.Value); } } }
public async Task Update(ISiteSettings site) { await _eventHandlers.HandleSitePreUpdate(site.Id).ConfigureAwait(false); _dataProtector.Protect(site); if (site.Id == Guid.Empty) { site.Id = Guid.NewGuid(); await _commands.Update(site, CancellationToken.None); } else { await _commands.Update(site, CancellationToken.None); } await _cacheHelper.SetDistributedCacheTimestamp(site.Id, site.LastModifiedUtc).ConfigureAwait(false); if (_multiTenantOptions.Mode == MultiTenantMode.FolderName) { if (string.IsNullOrEmpty(site.SiteFolderName)) { _cacheHelper.ClearCache("root"); } else { _cacheHelper.ClearCache(site.SiteFolderName); } } else { if (_context != null && !string.IsNullOrEmpty(_context.Request.Host.Value)) { _cacheHelper.ClearCache(_context.Request.Host.Value); } if (!string.IsNullOrWhiteSpace(site.PreferredHostName)) { _cacheHelper.ClearCache(site.PreferredHostName); } var siteHosts = await GetSiteHosts(site.Id); if (siteHosts != null && siteHosts.Count > 0) { foreach (ISiteHost siteHostName in siteHosts) { _cacheHelper.ClearCache(siteHostName.HostName); } } } _cacheHelper.ClearCache("site-" + site.Id.ToString()); await _eventHandlers.HandleSiteUpdated(site).ConfigureAwait(false); }
public async Task Save(ISiteSettings site) { dataProtector.Protect(site); if (site.Id == Guid.Empty) { site.Id = Guid.NewGuid(); await commands.Update(site, CancellationToken.None); } else { await commands.Update(site, CancellationToken.None); } }