Class BigSegmentsConfigurationBuilder
Contains methods for configuring the SDK's Big Segments behavior.
Implements
Inherited Members
Namespace: LaunchDarkly .Sdk.Server.Integrations
Assembly: LaunchDarkly.ServerSdk.dll
Syntax
public sealed class BigSegmentsConfigurationBuilder : IComponentConfigurer<BigSegmentsConfiguration>
Remarks
"Big Segments" are a specific type of segments. For more information, read the LaunchDarkly documentation about segments: https://docs.launchdarkly.com/home/users/segments
If you want to set non-default values for any of these properties, create a builder with
Big
Examples
// This example uses the Redis integration
var config = Configuration.Builder(sdkKey)
.BigSegments(Components.BigSegments(Redis.DataStore().Prefix("app1"))
.ContextCacheSize(2000))
.Build();
Fields
| Edit this page View SourceDefaultContextCacheSize
Default value for Context
Declaration
public const int DefaultContextCacheSize = 1000
Field Value
Type | Description |
---|---|
int |
DefaultContextCacheTime
Default value for Context
Declaration
public static readonly TimeSpan DefaultContextCacheTime
Field Value
Type | Description |
---|---|
Time |
DefaultStaleAfter
Default value for Stale
Declaration
public static readonly TimeSpan DefaultStaleAfter
Field Value
Type | Description |
---|---|
Time |
DefaultStatusPollInterval
Default value for Status
Declaration
public static readonly TimeSpan DefaultStatusPollInterval
Field Value
Type | Description |
---|---|
Time |
Methods
| Edit this page View SourceBuild(LdClientContext)
Called internally by the SDK to create an implementation instance. Applications should not need to call this method.
Declaration
public BigSegmentsConfiguration Build(LdClientContext context)
Parameters
Type | Name | Description |
---|---|---|
Ld |
context | provides configuration properties and other components from the current SDK client instance |
Returns
Type | Description |
---|---|
Big |
a instance of the component type |
ContextCacheSize(int)
Sets the maximum number of contexts whose Big Segment state will be cached by the SDK at any given time.
Declaration
public BigSegmentsConfigurationBuilder ContextCacheSize(int contextCacheSize)
Parameters
Type | Name | Description |
---|---|---|
int | contextCacheSize | the maximum number of context states to cache |
Returns
Type | Description |
---|---|
Big |
the builder |
Remarks
To reduce database traffic, the SDK maintains a least-recently-used cache by context key. When a feature flag that references a Big Segment is evaluated for some context that is not currently in the cache, the SDK queries the database for all Big Segment memberships of that context, and stores them together in a single cache entry. If the cache is full, the oldest entry is dropped.
A higher value for Context
Cache entries can also expire based on the setting of Context
See Also
| Edit this page View SourceContextCacheTime(TimeSpan)
Sets the maximum length of time that the Big Segment state for a context will be cached by the SDK.
Declaration
public BigSegmentsConfigurationBuilder ContextCacheTime(TimeSpan contextCacheTime)
Parameters
Type | Name | Description |
---|---|---|
Time |
contextCacheTime | the cache TTL |
Returns
Type | Description |
---|---|
Big |
the builder |
Remarks
See Context
See Also
| Edit this page View SourceStaleAfter(TimeSpan)
Sets the maximum length of time between updates of the Big Segments data before the data is considered out of date.
Declaration
public BigSegmentsConfigurationBuilder StaleAfter(TimeSpan staleAfter)
Parameters
Type | Name | Description |
---|---|---|
Time |
staleAfter | the time limit for marking the data as stale (any value less
than or equal to zero will be changed to Default |
Returns
Type | Description |
---|---|
Big |
the builder |
Remarks
Normally, the LaunchDarkly Relay Proxy updates a timestamp in the Big Segments store at intervals to
confirm that it is still in sync with the LaunchDarkly data, even if there have been no changes to the
data. If the timestamp falls behind the current time by the amount specified in
Stale
While in a stale state, the SDK will still continue using the last known data, but
Status will return true in its Stale property, and any
Evaluation
StatusPollInterval(TimeSpan)
Sets the interval at which the SDK will poll the Big Segment store to make sure it is available and to determine how long ago it was updated.
Declaration
public BigSegmentsConfigurationBuilder StatusPollInterval(TimeSpan statusPollInterval)
Parameters
Type | Name | Description |
---|---|---|
Time |
statusPollInterval | the status polling interval (any value less than or
equal to zero will be changed to Default |
Returns
Type | Description |
---|---|
Big |
the builder |