LaunchDarkly Dotnet Server SDK
Search Results for

    Show / Hide Table of Contents

    Class PersistentDataStoreBuilder

    A configurable data store factory that adds caching behavior to a persistent data store implementation.

    Inheritance
    object
    PersistentDataStoreBuilder
    Implements
    IComponentConfigurer<IDataStore>
    IDiagnosticDescription
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: LaunchDarkly.Sdk.Server.Integrations
    Assembly: LaunchDarkly.ServerSdk.dll
    Syntax
    public class PersistentDataStoreBuilder : IComponentConfigurer<IDataStore>, IDiagnosticDescription
    Remarks

    For a persistent data store (e.g. a database integration), the store implementation will provide an IComponentConfigurer<T> for IPersistentDataStore or IPersistentDataStoreAsync that implements the specific data store behavior. The SDK then provides additional options for caching; those are defined by this type, which is returned by PersistentDataStore(IComponentConfigurer<IPersistentDataStore>) or PersistentDataStore(IComponentConfigurer<IPersistentDataStoreAsync>). Example usage:

    var myStore = Components.PersistentDataStore(Redis.FeatureStore())
        .CacheTtl(TimeSpan.FromSeconds(45));
    var config = Configuration.Builder(sdkKey)
        .DataStore(myStore)
        .Build();

    Fields

    | Edit this page View Source

    DefaultTtl

    The default cache expiration time.

    Declaration
    public static readonly TimeSpan DefaultTtl
    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 IDataStore Build(LdClientContext context)
    Parameters
    Type Name Description
    LdClientContext context

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

    Returns
    Type Description
    IDataStore

    a instance of the component type

    | Edit this page View Source

    CacheForever()

    Specifies that the in-memory cache should never expire.

    Declaration
    public PersistentDataStoreBuilder CacheForever()
    Returns
    Type Description
    PersistentDataStoreBuilder

    the builder

    Remarks

    In this mode, data will be written to both the underlying persistent store and the cache, but will only ever be read from the persistent store if the SDK is restarted.

    Use this mode with caution: it means that in a scenario where multiple processes are sharing the database, and the current process loses connectivity to LaunchDarkly while other processes are still receiving updates and writing them to the database, the current process will have stale data.

    | Edit this page View Source

    CacheMaximumEntries(int?)

    Specifies the maximum number of entries that can be held in the cache at a time.

    Declaration
    public PersistentDataStoreBuilder CacheMaximumEntries(int? maximumEntries)
    Parameters
    Type Name Description
    int? maximumEntries

    the maximum number of entries, or null for no limit

    Returns
    Type Description
    PersistentDataStoreBuilder

    an updated factory object

    Remarks

    If this limit is exceeded, older entries will be evicted from the cache to make room for new ones.

    If this is null, there is no limit on the number of entries.

    | Edit this page View Source

    CacheMillis(int)

    Shortcut for calling CacheTime(TimeSpan) with a time span in milliseconds.

    Declaration
    public PersistentDataStoreBuilder CacheMillis(int millis)
    Parameters
    Type Name Description
    int millis

    the cache TTL in milliseconds

    Returns
    Type Description
    PersistentDataStoreBuilder

    the builder

    | Edit this page View Source

    CacheSeconds(int)

    Shortcut for calling CacheTime(TimeSpan) with a time span in seconds.

    Declaration
    public PersistentDataStoreBuilder CacheSeconds(int seconds)
    Parameters
    Type Name Description
    int seconds

    the cache TTL in seconds

    Returns
    Type Description
    PersistentDataStoreBuilder

    the builder

    | Edit this page View Source

    CacheTime(TimeSpan)

    Specifies the cache TTL. Items will expire from the cache after this amount of time from the time when they were originally cached.

    Declaration
    public PersistentDataStoreBuilder CacheTime(TimeSpan cacheTime)
    Parameters
    Type Name Description
    TimeSpan cacheTime

    the cache TTL

    Returns
    Type Description
    PersistentDataStoreBuilder

    the builder

    Remarks

    If the value is TimeSpan.Zero, caching is disabled (equivalent to NoCaching()).

    If the value is System.Threading.Timeout.InfiniteTimeSpan (or any negative number), data is cached forever (equivalent to CacheForever()).

    | Edit this page View Source

    DescribeConfiguration(LdClientContext)

    Called internally by the SDK to inspect the configuration. Applications do not need to call this method.

    Declaration
    public LdValue DescribeConfiguration(LdClientContext context)
    Parameters
    Type Name Description
    LdClientContext context

    SDK configuration/component information

    Returns
    Type Description
    LdValue

    a JSON value

    | Edit this page View Source

    NoCaching()

    Specifies that the SDK should not use an in-memory cache for the persistent data store.

    Declaration
    public PersistentDataStoreBuilder NoCaching()
    Returns
    Type Description
    PersistentDataStoreBuilder

    the builder

    Remarks

    This means that every feature flag evaluation will trigger a data store query.

    Implements

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