Browse Source

Bugfix with caching

pull/1/head
Sebastian 10 years ago
parent
commit
3227a8a313
  1. 6
      src/Squidex.Read/Apps/IAppEntity.cs
  2. 14
      src/Squidex.Read/Apps/Services/Implementations/CachingAppProvider.cs
  3. 13
      src/Squidex.Read/Schemas/Services/Implementations/CachingSchemaProvider.cs
  4. 5
      src/Squidex/app/framework/angular/modal-view.directive.ts

6
src/Squidex.Read/Apps/IAppEntity.cs

@ -17,10 +17,10 @@ namespace Squidex.Read.Apps
Language MasterLanguage { get; }
IEnumerable<IAppClientEntity> Clients { get; }
IReadOnlyCollection<IAppClientEntity> Clients { get; }
IEnumerable<IAppContributorEntity> Contributors { get; }
IReadOnlyCollection<IAppContributorEntity> Contributors { get; }
IEnumerable<Language> Languages { get; }
IReadOnlyCollection<Language> Languages { get; }
}
}

14
src/Squidex.Read/Apps/Services/Implementations/CachingAppProvider.cs

@ -88,9 +88,9 @@ namespace Squidex.Read.Apps.Services.Implementations
public Task On(Envelope<IEvent> @event)
{
if (@event.Payload is AppContributorAssigned ||
if (@event.Payload is AppContributorAssigned ||
@event.Payload is AppContributorRemoved ||
@event.Payload is AppClientAttached ||
@event.Payload is AppClientAttached ||
@event.Payload is AppClientRevoked ||
@event.Payload is AppClientRenamed ||
@event.Payload is AppLanguageAdded ||
@ -108,6 +108,16 @@ namespace Squidex.Read.Apps.Services.Implementations
Cache.Remove(cacheKey);
}
else
{
var appCreated = @event.Payload as AppCreated;
if (appCreated != null)
{
Cache.Remove(BuildIdCacheKey(@event.Headers.AggregateId()));
Cache.Remove(BuildNameCacheKey(appCreated.Name));
}
}
return Task.FromResult(true);
}

13
src/Squidex.Read/Schemas/Services/Implementations/CachingSchemaProvider.cs

@ -89,8 +89,7 @@ namespace Squidex.Read.Schemas.Services.Implementations
public Task On(Envelope<IEvent> @event)
{
if (@event.Payload is SchemaDeleted ||
@event.Payload is SchemaCreated)
if (@event.Payload is SchemaDeleted)
{
var cacheKey = BuildIdCacheKey(@event.Headers.AggregateId());
@ -103,6 +102,16 @@ namespace Squidex.Read.Schemas.Services.Implementations
Cache.Remove(cacheKey);
}
else
{
var schemaCreated = @event.Payload as SchemaCreated;
if (schemaCreated != null)
{
Cache.Remove(BuildIdCacheKey(@event.Headers.AggregateId()));
Cache.Remove(BuildNameCacheKey(@event.Headers.AppId(), schemaCreated.Name));
}
}
return Task.FromResult(true);
}

5
src/Squidex/app/framework/angular/modal-view.directive.ts

@ -62,7 +62,10 @@ export class ModalViewDirective implements OnChanges, OnInit, OnDestroy {
}
public ngOnChanges() {
this.subscription.unsubscribe();
if (this.subscription) {
this.subscription.unsubscribe();
this.subscription = null;
}
if (this.modalView) {
this.subscription = this.modalView.isOpen.subscribe(isOpen => {

Loading…
Cancel
Save