code: protected void applyCachePolicy() {
          // Run through all the active clients and gather status.
          CacheStatus currentStatus = collectStatus();
          if (currentStatus == null || currentStatus.getSize() == 0) {
              // This indicates we have no clients or those clients have no data.
              this.cacheSize.set(0);
              return;
          }
  
          // Increment current generation (if needed).
          boolean currentChanged = adjustCurrentGeneration(currentStatus);
  
          // Increment oldest generation (if needed and if possible).
          boolean oldestChanged = adjustOldestGeneration(currentStatus);
  
          if (!currentChanged && !oldestChanged) {
              // Nothing changed, nothing to do.
              return;
          }
  
          // Notify clients that something changed (if any of the above got changed). Run in a loop, until either we can't
          // adjust the oldest anymore or we are unable to trigger any changes to the clients.
          long sizeReduction;
          do {
              sizeReduction = updateClients();
              if (sizeReduction > 0) {
                  currentStatus = currentStatus.withUpdatedSize(-sizeReduction);
                  logCurrentStatus(currentStatus);
                  oldestChanged = adjustOldestGeneration(currentStatus);
              }
          } while (sizeReduction > 0 && oldestChanged);
          this.cacheSize.set(currentStatus.getSize());
          this.metrics.report(currentStatus.getSize(), currentStatus.getNewestGeneration() - currentStatus.getOldestGeneration());
      }
docs: region Helpers