public abstract class Redis
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static RedisStoreBuilder<com.launchdarkly.sdk.server.subsystems.BigSegmentStore> |
bigSegmentStore()
Returns a builder object for creating a Redis-backed Big Segment store.
|
static RedisStoreBuilder<com.launchdarkly.sdk.server.subsystems.PersistentDataStore> |
dataStore()
Returns a builder object for creating a Redis-backed persistent data store.
|
public static RedisStoreBuilder<com.launchdarkly.sdk.server.subsystems.PersistentDataStore> dataStore()
This is for the main data store that holds feature flag data. To configure a
Big Segment store, use bigSegmentStore() instead.
You can use methods of the builder to specify any non-default Redis options
you may want, before passing the builder to Components.persistentDataStore(ComponentConfigurer).
In this example, the store is configured to use a Redis host called "host1":
LDConfig config = new LDConfig.Builder()
.dataStore(
Components.persistentDataStore(
Redis.dataStore().uri(URI.create("redis://host1:6379")
)
)
.build();
Note that the SDK also has its own options related to data storage that are configured
at a different level, because they are independent of what database is being used. For
instance, the builder returned by Components.persistentDataStore(ComponentConfigurer)
has options for caching:
LDConfig config = new LDConfig.Builder()
.dataStore(
Components.persistentDataStore(
Redis.dataStore().uri(URI.create("redis://my-redis-host"))
).cacheSeconds(15)
)
.build();
public static RedisStoreBuilder<com.launchdarkly.sdk.server.subsystems.BigSegmentStore> bigSegmentStore()
You can use methods of the builder to specify any non-default Redis options
you may want, before passing the builder to Components.bigSegments(ComponentConfigurer).
In this example, the store is configured to use a Redis host called "host2":
LDConfig config = new LDConfig.Builder()
.bigSegments(
Components.bigSegments(
Redis.bigSegmentStore().uri(URI.create("redis://host2:6379")
)
)
.build();
Note that the SDK also has its own options related to Big Segments that are configured
at a different level, because they are independent of what database is being used. For
instance, the builder returned by Components.bigSegments(ComponentConfigurer)
has an option for the status polling interval:
LDConfig config = new LDConfig.Builder()
.dataStore(
Components.bigSegments(
Redis.bigSegmentStore().uri(URI.create("redis://my-redis-host"))
).statusPollInterval(Duration.ofSeconds(30))
)
.build();