class CacheDistributionAdvisor extends DistributionAdvisor {

  Set adviseUpdate(final EntryEventImpl event) throws IllegalStateException {
    if (event.hasNewValue() || event.getOperation().isPutAll()) {
      // only need to distribute it to members that want all events or cache data
      return adviseAllEventsOrCached();
    } else {
      // The new value is null so this is a create with a null value,
      // in which case we only need to distribute this message to replicates
      // or all events that are not a proxy or if a proxy has a listener

      // minimize volatile reads by copying ref to local var
      long tempProfilesVersion = profilesVersion; // volatile read

      if (adviseUpdateVersion != tempProfilesVersion) {
        synchronized (adviseSetforUpdate) {
          if (adviseUpdateVersion != tempProfilesVersion) {

            adviseSetforUpdate = Collections.unmodifiableSet(adviseFilter(profile -> {
              CacheProfile cp = (CacheProfile) profile;
              DataPolicy dp = cp.getDataPolicy();
              return dp.withReplication()
                  || (cp.allEvents() && (dp.withStorage() || cp.hasCacheListener));
            }));
            adviseUpdateVersion = tempProfilesVersion;
          }
        }
      }
      return adviseSetforUpdate;
    }
  }

  protected  CacheDistributionAdvisor(CacheDistributionAdvisee region);

}