class NpmProxyCacheInvalidatorFacetImpl extends FacetSupport {

  @Subscribe
  @AllowConcurrentEvents
  protected void on(final RepositoryUpdatedEvent event) {
    final Repository repository = event.getRepository();

    repository.optionalFacet(NpmProxyFacet.class).ifPresent(npm -> {
      if (!Objects.equals(getRemoteUrl(repository.getConfiguration()), getRemoteUrl(event.getOldConfiguration()))) {
        npm.invalidateProxyCaches();
      }
    });
  }

}