LaunchDarkly Dotnet Server SDK
Search Results for

    Show / Hide Table of Contents

    Class BigSegmentsConfigurationBuilder

    Contains methods for configuring the SDK's Big Segments behavior.

    Inheritance
    object
    BigSegmentsConfigurationBuilder
    Implements
    IComponentConfigurer<BigSegmentsConfiguration>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 BigSegments(IComponentConfigurer<IBigSegmentStore>), change its properties with the methods of this class, and pass it to BigSegments(IComponentConfigurer<BigSegmentsConfiguration>):

    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 Source

    DefaultContextCacheSize

    Default value for ContextCacheSize(int).

    Declaration
    public const int DefaultContextCacheSize = 1000
    Field Value
    Type Description
    int
    | Edit this page View Source

    DefaultContextCacheTime

    Default value for ContextCacheTime(TimeSpan): five seconds.

    Declaration
    public static readonly TimeSpan DefaultContextCacheTime
    Field Value
    Type Description
    TimeSpan
    | Edit this page View Source

    DefaultStaleAfter

    Default value for StaleAfter(TimeSpan): two minutes.

    Declaration
    public static readonly TimeSpan DefaultStaleAfter
    Field Value
    Type Description
    TimeSpan
    | Edit this page View Source

    DefaultStatusPollInterval

    Default value for StatusPollInterval(TimeSpan): five seconds.

    Declaration
    public static readonly TimeSpan DefaultStatusPollInterval
    Field Value
    Type Description
    TimeSpan

    Methods

    | Edit this page View Source

    Build(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
    LdClientContext context

    provides configuration properties and other components from the current SDK client instance

    Returns
    Type Description
    BigSegmentsConfiguration

    a instance of the component type

    | Edit this page View Source

    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
    BigSegmentsConfigurationBuilder

    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 ContextCacheSize(int) means that database queries for Big Segments will be done less often for recently-referenced contexts, if the application has many contexts, at the cost of increased memory used by the cache.

    Cache entries can also expire based on the setting of ContextCacheTime(TimeSpan).

    See Also
    DefaultContextCacheSize
    | Edit this page View Source

    ContextCacheTime(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
    TimeSpan contextCacheTime

    the cache TTL

    Returns
    Type Description
    BigSegmentsConfigurationBuilder

    the builder

    Remarks

    See ContextCacheSize(int) for more about this cache. A higher value for ContextCacheTime(TimeSpan) means that database queries for the Big Segment state of any given context will be done less often, but that changes to segment membership may not be detected as soon.

    See Also
    DefaultContextCacheTime
    | Edit this page View Source

    StaleAfter(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
    TimeSpan staleAfter

    the time limit for marking the data as stale (any value less than or equal to zero will be changed to DefaultStaleAfter)

    Returns
    Type Description
    BigSegmentsConfigurationBuilder

    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 StaleAfter(TimeSpan), the SDK assumes that something is not working correctly in this process and that the data may not be accurate.

    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 EvaluationReason generated from a feature flag that references a Big Segment will have a BigSegmentsStatus of Stale.

    | Edit this page View Source

    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
    TimeSpan statusPollInterval

    the status polling interval (any value less than or equal to zero will be changed to DefaultStatusPollInterval)

    Returns
    Type Description
    BigSegmentsConfigurationBuilder

    the builder

    See Also
    DefaultStatusPollInterval

    Implements

    IComponentConfigurer<T>
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX