LaunchDarkly Dotnet Client SDK
Search Results for

    Show / Hide Table of Contents

    Class PersistenceConfigurationBuilder

    Contains methods for configuring the SDK's persistent storage behavior.

    Inheritance
    object
    PersistenceConfigurationBuilder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: LaunchDarkly.Sdk.Client.Integrations
    Assembly: LaunchDarkly.ClientSdk.dll
    Syntax
    public sealed class PersistenceConfigurationBuilder
    Remarks

    The persistent storage mechanism allows the SDK to immediately access the last known flag data for the user, if any, if it was started offline or has not yet received data from LaunchDarkly.

    By default, the SDK uses a persistence mechanism that is specific to each platform, as described in Storage(IComponentConfigurer<IPersistentDataStore>). To use a custom persistence implementation, or to customize related properties defined in this class, create a builder with Persistence(), change its properties with the methods of this class, and pass it to Persistence(PersistenceConfigurationBuilder).

    Examples
    var config = Configuration.Builder(sdkKey)
        .Persistence(
            Components.Persistence().MaxCachedUsers(5)
        )
        .Build();

    Fields

    | Edit this page View Source

    DefaultMaxCachedContexts

    Default value for MaxCachedContexts(int): 5.

    Declaration
    public const int DefaultMaxCachedContexts = 5
    Field Value
    Type Description
    int
    | Edit this page View Source

    UnlimitedCachedContexts

    Passing this value (or any negative number) to MaxCachedContexts(int) means there is no limit on cached user data.

    Declaration
    public const int UnlimitedCachedContexts = -1
    Field Value
    Type Description
    int

    Methods

    | Edit this page View Source

    MaxCachedContexts(int)

    Sets the maximum number of users to store flag data for.

    Declaration
    public PersistenceConfigurationBuilder MaxCachedContexts(int maxCachedContexts)
    Parameters
    Type Name Description
    int maxCachedContexts
    Returns
    Type Description
    PersistenceConfigurationBuilder

    the builder

    Remarks

    A value greater than zero means that the SDK will use persistent storage to remember the last known flag values for up to that number of unique user keys. If the limit is exceeded, the SDK discards the data for the least recently used user.

    A value of zero means that the SDK will not use persistent storage; it will only have whatever flag data it has received since the current LdClient instance was started.

    A value of UnlimitedCachedContexts or any other negative number means there is no limit. Use this mode with caution, as it could cause the size of mobile device preferences to grow indefinitely if your application uses many different user keys on the same device.

    | Edit this page View Source

    Storage(IComponentConfigurer<IPersistentDataStore>)

    Sets the storage implementation.

    Declaration
    public PersistenceConfigurationBuilder Storage(IComponentConfigurer<IPersistentDataStore> persistentDataStoreFactory)
    Parameters
    Type Name Description
    IComponentConfigurer<IPersistentDataStore> persistentDataStoreFactory

    a factory for the custom storage implementation, or null to use the default implementation

    Returns
    Type Description
    PersistenceConfigurationBuilder

    the builder

    Remarks

    By default, the SDK uses a persistence mechanism that is specific to each platform: on Android and iOS it is the native preferences store, and in the .NET Standard implementation for desktop apps it is the System.IO.IsolatedStorage API. You may use this method to specify a custom implementation using a factory object.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX