/** * Constructs an instance initialised with the supplied settings. * * @param settings the settings to configure the instance with. */ public JvmCacheSettingsBuilder(JvmCacheSettings settings) { this.maxEntries = settings.getMaxEntries(); this.defaultTtl = settings.getDefaultTtl(); }
/** * Returns a new {@link JvmCacheSettings} instance where the current settings * are overridden with settings specified in <tt>overrides</tt>. Only properties * in <tt>overrides</tt> that are present will be applied. * * @param overrides contains the settings to override * @return a new {@link JvmCacheSettings} instance with the <tt>overrides</tt> settings applied. */ public JvmCacheSettings override(JvmCacheSettings overrides) { return new JvmCacheSettings( ifPresent(overrides.getMaxEntries(), getMaxEntries()), ifPresent(overrides.getDefaultTtl(), getDefaultTtl())); }
assertThat(cacheDetails.getSettings().getDefaultTtl(), is(Optional.of(MAX_TTL))); assertThat(cacheDetails.getSettings().getMaxEntries(), is(Optional.of(MAX_ENTRIES)));