public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectSize(long size, MemoryUnit unit) {
    DefaultSizeOfEngineProviderConfiguration configuration = configBuilder.findServiceByClass(DefaultSizeOfEngineProviderConfiguration.class);
    if (configuration == null) {
      return new CacheManagerBuilder<>(this, configBuilder.addService(new DefaultSizeOfEngineProviderConfiguration(size, unit, DEFAULT_OBJECT_GRAPH_SIZE)));
    } else {
      ConfigurationBuilder builder = configBuilder.removeService(configuration);
      return new CacheManagerBuilder<>(this, builder.addService(new DefaultSizeOfEngineProviderConfiguration(size, unit, configuration
        .getMaxObjectGraphSize())));
    }
  }
public CacheManagerBuilder < T > withDefaultSizeOfMaxObjectSize ( long size , MemoryUnit unit ) { DefaultSizeOfEngineProviderConfiguration configuration = configBuilder . findServiceByClass ( DefaultSizeOfEngineProviderConfiguration . class ) ; if ( configuration == null ) { return new CacheManagerBuilder < > ( this , configBuilder . addService ( new DefaultSizeOfEngineProviderConfiguration ( size , unit , DEFAULT_OBJECT_GRAPH_SIZE ) ) ) ; } else { ConfigurationBuilder builder = configBuilder . removeService ( configuration ) ; return new CacheManagerBuilder < > ( this , builder . addService ( new DefaultSizeOfEngineProviderConfiguration ( size , unit , configuration . getMaxObjectGraphSize ( ) ) ) ) ; } }
Adds a default {@link SizeOfEngine} configuration, that limits the max object size, to
the returned builder.

@param size the max object size
@param unit the max object size unit
@return a new builder with the added configuration