Class PersistentDataStoreBuilder

java.lang.Object
com.launchdarkly.sdk.server.integrations.PersistentDataStoreBuilder
All Implemented Interfaces:
DataStoreFactory

public abstract class PersistentDataStoreBuilder
extends java.lang.Object
implements DataStoreFactory
A configurable factory for a persistent data store.

Several database integrations exist for the LaunchDarkly SDK, each with its own behavior and options specific to that database; this is described via some implementation of PersistentDataStoreFactory. There is also universal behavior that the SDK provides for all persistent data stores, such as caching; the PersistentDataStoreBuilder adds this.

After configuring this object, pass it to LDConfig.Builder.dataStore(DataStoreFactory) to use it in the SDK configuration. For example, using the Redis integration:


     LDConfig config = new LDConfig.Builder()
         .dataStore(
             Components.persistentDataStore(
                 Redis.dataStore().url("redis://my-redis-host")
             ).cacheSeconds(15)
         )
         .build();
 
In this example, .url() is an option specifically for the Redis integration, whereas cacheSeconds() is an option that can be used for any persistent data store.

Note that this class is abstract; the actual implementation is created by calling Components.persistentDataStore(PersistentDataStoreFactory).

Since:
4.12.0