Show / Hide Table of Contents

Class RedisStoreBuilder<T>

A builder for configuring the Redis-based persistent data store.

Inheritance
System.Object
RedisStoreBuilder<T>
Implements
LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer<T>
LaunchDarkly.Sdk.Server.Subsystems.IDiagnosticDescription
Namespace: LaunchDarkly.Sdk.Server.Integrations
Assembly: LaunchDarkly.ServerSdk.Redis.dll
Syntax
public abstract class RedisStoreBuilder<T> : Object, IComponentConfigurer<T>, IDiagnosticDescription
Type Parameters
Name Description
T
Remarks

This can be used either for the main data store that holds feature flag data, or for the big segment store, or both. If you are using both, they do not have to have the same parameters. For instance, in this example the main data store uses a Redis host called "host1" and the big segment store uses a Redis host called "host2":

    var config = Configuration.Builder("sdk-key")
        .DataStore(
            Components.PersistentDataStore(
                Redis.DataStore().Uri("redis://host1:6379")
            )
        )
        .BigSegments(
            Components.BigSegments(
                Redis.DataStore().Uri("redis://host2:6379")
            )
        )
        .Build();

Note that the builder is passed to one of two methods, LaunchDarkly.Sdk.Server.Components.PersistentDataStore(LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer{LaunchDarkly.Sdk.Server.Subsystems.IPersistentDataStore}) or LaunchDarkly.Sdk.Server.Components.BigSegments(LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer{LaunchDarkly.Sdk.Server.Subsystems.IBigSegmentStore}), depending on the context in which it is being used. This is because each of those contexts has its own additional configuration options that are unrelated to the Redis options.

Builder calls can be chained, for example:

    var config = Configuration.Builder("sdk-key")
        .DataStore(
            Components.PersistentDataStore(
                Redis.DataStore()
                    .Uri("redis://my-redis-host")
                    .Database(1)
                )
                .CacheSeconds(15)
            )
        .Build();

Methods

Build(LdClientContext)

Declaration
public abstract T Build(LdClientContext context)
Parameters
Type Name Description
LaunchDarkly.Sdk.Server.Subsystems.LdClientContext context
Returns
Type Description
T

ConnectTimeout(TimeSpan)

Specifies the maximum time to wait for a connection to the Redis server.

Declaration
public RedisStoreBuilder<T> ConnectTimeout(TimeSpan timeout)
Parameters
Type Name Description
System.TimeSpan timeout

the timeout interval

Returns
Type Description
RedisStoreBuilder<T>

the builder

DatabaseIndex(Int32)

Specifies which database to use within the Redis server. The default is 0.

Declaration
public RedisStoreBuilder<T> DatabaseIndex(int database)
Parameters
Type Name Description
System.Int32 database

index of the database to use

Returns
Type Description
RedisStoreBuilder<T>

the builder

DescribeConfiguration(LdClientContext)

Declaration
public LdValue DescribeConfiguration(LdClientContext context)
Parameters
Type Name Description
LaunchDarkly.Sdk.Server.Subsystems.LdClientContext context
Returns
Type Description
LaunchDarkly.Sdk.LdValue

EndPoint(EndPoint)

Specifies a single Redis server as an EndPoint.

Declaration
public RedisStoreBuilder<T> EndPoint(EndPoint endPoint)
Parameters
Type Name Description
System.Net.EndPoint endPoint

location of the Redis server

Returns
Type Description
RedisStoreBuilder<T>

the builder

EndPoints(IList<EndPoint>)

Specifies multiple Redis servers as a list of EndPoints.

Declaration
public RedisStoreBuilder<T> EndPoints(IList<EndPoint> endPoints)
Parameters
Type Name Description
System.Collections.Generic.IList<System.Net.EndPoint> endPoints

locations of the Redis servers

Returns
Type Description
RedisStoreBuilder<T>

the builder

HostAndPort(String, Int32)

Specifies a single Redis server by hostname and port.

Declaration
public RedisStoreBuilder<T> HostAndPort(string host, int port)
Parameters
Type Name Description
System.String host

hostname of the Redis server

System.Int32 port

port of the Redis server

Returns
Type Description
RedisStoreBuilder<T>

the builder

OperationTimeout(TimeSpan)

Specifies the maximum time to wait for each synchronous Redis operation to complete. If you are seeing timeout errors - which could result from either an overburdened Redis server, or an unusually large operation such as storing a very large feature flag - you may want to increase this setting.

Declaration
public RedisStoreBuilder<T> OperationTimeout(TimeSpan timeout)
Parameters
Type Name Description
System.TimeSpan timeout

the timeout interval

Returns
Type Description
RedisStoreBuilder<T>

the builder

Prefix(String)

Specifies the namespace prefix for all keys stored in Redis.

Declaration
public RedisStoreBuilder<T> Prefix(string prefix)
Parameters
Type Name Description
System.String prefix

the namespace prefix, or null to use DefaultPrefix

Returns
Type Description
RedisStoreBuilder<T>

the builder

RedisConfigChanges(Action<ConfigurationOptions>)

Allows you to modify any of the configuration options supported by StackExchange.Redis directly. The current configuration will be passed to your Action, which can modify it in any way.

Declaration
public RedisStoreBuilder<T> RedisConfigChanges(Action<ConfigurationOptions> modifyConfig)
Parameters
Type Name Description
System.Action<StackExchange.Redis.ConfigurationOptions> modifyConfig
Returns
Type Description
RedisStoreBuilder<T>
Examples
    Redis.DataStore()
        .RedisConfigChanges((config) => {
            config.Ssl = true;
        })

RedisConfiguration(ConfigurationOptions)

Specifies all Redis configuration options at once.

Declaration
public RedisStoreBuilder<T> RedisConfiguration(ConfigurationOptions config)
Parameters
Type Name Description
StackExchange.Redis.ConfigurationOptions config

a StackExchange.Redis.ConfigurationOptions instance

Returns
Type Description
RedisStoreBuilder<T>

the builder

Uri(String)

Shortcut for calling Uri(Uri) with a string.

Declaration
public RedisStoreBuilder<T> Uri(string uri)
Parameters
Type Name Description
System.String uri

the Redis server URI as a string

Returns
Type Description
RedisStoreBuilder<T>

the builder

See Also
Uri(Uri)

Uri(Uri)

Specifies a Redis server - and, optionally, other properties including credentials and database number - using a URI.

Declaration
public RedisStoreBuilder<T> Uri(Uri uri)
Parameters
Type Name Description
System.Uri uri

the Redis server URI

Returns
Type Description
RedisStoreBuilder<T>

the builder

See Also
Uri(String)

Implements

LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer<>
LaunchDarkly.Sdk.Server.Subsystems.IDiagnosticDescription
In This Article
Back to top Generated by DocFX