private Optional<Value> valueOrDefault(Key key, Optional<Value> value) {
    // If value is present simply return it
    if(value.isPresent()) {
      return value;
    }

    if(!cacheMissingValues) {
      delegate.invalidate(key);
    }

    return defaultValue;
  }
private Optional < Value > valueOrDefault ( Key key , Optional < Value > value ) { if ( value . isPresent ( ) ) { return value ; } if ( ! cacheMissingValues ) { delegate . invalidate ( key ) ; } return defaultValue ; }
Internal method to ensure that we return and not cache the default value if needed