1 package com.atlassian.vcache;
2
3 import com.atlassian.annotations.PublicApi;
4
5 import java.util.Optional;
6
7 /**
8 * Builder for creating {@link RequestCacheSettings} instances.
9 *
10 * @since 1.13.0
11 */
12 @PublicApi
13 public class RequestCacheSettingsBuilder {
14
15 private Optional<ChangeRate> changeRate = Optional.empty();
16
17 /**
18 * Provides a hint on the expected change rate for data updates.
19 *
20 * @param hint the expected change rate for data updates.
21 * @return the builder
22 */
23 public RequestCacheSettingsBuilder dataChangeRateHint(final ChangeRate hint) {
24 this.changeRate = Optional.of(hint);
25 return this;
26 }
27
28 /**
29 * Returns a new {@link RequestCacheSettings} instance configured using the supplied settings.
30 *
31 * @return a new {@link RequestCacheSettings} instance configured using the supplied settings.
32 */
33 public RequestCacheSettings build() {
34 return new RequestCacheSettings(changeRate.orElse(ChangeRate.HIGH_CHANGE));
35 }
36 }