public boolean requiresInitialization(FileLock lock) {
      if (!didRebuild) {
        if (validator != null && !validator.isValid()) {
          LOGGER.debug(
              "Invalidating {} as cache validator return false.",
              DefaultPersistentDirectoryCache.this);
          return true;
        }
      }

      if (!lock.getUnlockedCleanly()) {
        if (!lock.getState().isInInitialState()) {
          LOGGER.warn(
              "Invalidating {} as it was not closed cleanly.",
              DefaultPersistentDirectoryCache.this);
        }
        return true;
      }

      Properties cachedProperties = GUtil.loadProperties(propertiesFile);
      for (Map.Entry<?, ?> entry : properties.entrySet()) {
        String previousValue = cachedProperties.getProperty(entry.getKey().toString());
        String currentValue = entry.getValue().toString();
        if (!previousValue.equals(currentValue)) {
          LOGGER.debug(
              "Invalidating {} as cache property {} has changed from {} to {}.",
              DefaultPersistentDirectoryCache.this,
              entry.getKey(),
              previousValue,
              currentValue);
          return true;
        }
      }
      return false;
    }