Class Redis
Integration between the LaunchDarkly SDK and Redis.
Inheritance
Namespace: LaunchDarkly.Sdk.Server.Integrations
Assembly: LaunchDarkly.ServerSdk.Redis.dll
Syntax
public static class Redis : Object
Fields
DefaultConnectTimeout
The default value for ConnectTimeout(TimeSpan).
Declaration
public static readonly TimeSpan DefaultConnectTimeout
Field Value
Type | Description |
---|---|
System.TimeSpan |
DefaultOperationTimeout
The default value for OperationTimeout(TimeSpan).
Declaration
public static readonly TimeSpan DefaultOperationTimeout
Field Value
Type | Description |
---|---|
System.TimeSpan |
DefaultPrefix
The default value for Prefix(String).
Declaration
public static readonly string DefaultPrefix
Field Value
Type | Description |
---|---|
System.String |
DefaultRedisEndPoint
The default location of the Redis server: localhost:6379
Declaration
public static readonly EndPoint DefaultRedisEndPoint
Field Value
Type | Description |
---|---|
System.Net.EndPoint |
Methods
BigSegmentStore()
Returns a builder object for creating a Redis-backed Big Segment store.
Declaration
public static RedisStoreBuilder<IBigSegmentStore> BigSegmentStore()
Returns
Type | Description |
---|---|
RedisStoreBuilder<LaunchDarkly.Sdk.Server.Subsystems.IBigSegmentStore> | a Big Segment store configuration object |
Remarks
You can use methods of the builder to specify any non-default Redis options you may want, before passing the builder to LaunchDarkly.Sdk.Server.Components.BigSegments(LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer{LaunchDarkly.Sdk.Server.Subsystems.IBigSegmentStore}). In this example, the store is configured to use a Redis host called "host2":
var config = Configuration.Builder("sdk-key")
.DataStore(
Components.BigSegments(
Redis.BigSegmentStore().Uri("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 LaunchDarkly.Sdk.Server.Components.BigSegments(LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer{LaunchDarkly.Sdk.Server.Subsystems.IBigSegmentStore}) has an option for the status polling interval:
var config = Configuration.Builder("sdk-key")
.DataStore(
Components.BigSegments(
Redis.BigSegmentStore().Uri("redis://my-redis-host")
).StatusPollInterval(TimeSpan.FromSeconds(30))
)
.Build();
DataStore()
Returns a builder object for creating a Redis-backed persistent data store.
Declaration
public static RedisStoreBuilder<IPersistentDataStore> DataStore()
Returns
Type | Description |
---|---|
RedisStoreBuilder<LaunchDarkly.Sdk.Server.Subsystems.IPersistentDataStore> | a data store configuration object |
Remarks
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 LaunchDarkly.Sdk.Server.Components.PersistentDataStore(LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer{LaunchDarkly.Sdk.Server.Subsystems.IPersistentDataStore}). In this example, the store is configured to use a Redis host called "host1":
var config = Configuration.Builder("sdk-key")
.DataStore(
Components.PersistentDataStore(
Redis.DataStore().Uri("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 LaunchDarkly.Sdk.Server.Components.PersistentDataStore(LaunchDarkly.Sdk.Server.Subsystems.IComponentConfigurer{LaunchDarkly.Sdk.Server.Subsystems.IPersistentDataStore}) has options for caching:
var config = Configuration.Builder("sdk-key")
.DataStore(
Components.PersistentDataStore(
Redis.DataStore().Uri("redis://my-redis-host")
).CacheSeconds(15)
)
.Build();