Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface LDBigSegmentsOptions

Additional parameters for configuring the SDK's big segments behavior.

"Big segments" are a specific type of user segments. For more information, read the LaunchDarkly documentation about user segments: https://docs.launchdarkly.com/home/users

see

LDOptions.bigSegments

Hierarchy

  • LDBigSegmentsOptions

Index

Properties

Optional staleAfter

staleAfter: undefined | number

The maximum length of time between updates of the big segments data before the data is considered out of date, in seconds.

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 If the timestamp falls behind the current time by the amount specified in staleAfter, 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 the status from {@link interfaces.BigSegmentStoreStatusProvider.getStatus} will have stale: true, and any LDEvaluationReason generated from a feature flag that references a big segment will have a bigSegmentsStatus of "STALE".

If not specified, the default value is 120 (two minutes). Zero or negative values are changed to the default.

Optional statusPollInterval

statusPollInterval: undefined | number

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, in seconds.

If not specified, the default value is 5. Zero or negative values are changed to the default.

store

store: (options: LDOptions) => BigSegmentStore

Specifies the storage component that provides big segments data.

This property is mandatory. It must be obtained from one of the SDK's database integrations, such as https://github.com/launchdarkly/node-server-sdk-redis. You will normally specify a database implementation that matches how the LaunchDarkly Relay Proxy is configured, since the Relay Proxy manages the big segment data.

Type declaration

Optional userCacheSize

userCacheSize: undefined | number

The maximum number of users whose big segment state will be cached by the SDK at any given time.

To reduce database traffic, the SDK maintains a least-recently-used cache by user key. When a feature flag that references a big segment is evaluated for some user who is not currently in the cache, the SDK queries the database for all big segment memberships of that user, and stores them together in a single cache entry. If the cache is full, the oldest entry is dropped.

A higher value for userCacheSize means that database queries for big segments will be done less often for recently-referenced users, if the application has many users, at the cost of increased memory used by the cache.

Cache entries can also expire based on the setting of userCacheTime.

If not specified, the default value is 1000.

Optional userCacheTime

userCacheTime: undefined | number

The maximum length of time that the big segment state for a user will be cached by the SDK, in seconds.

See userCacheSize for more about this cache. A higher value for userCacheTime means that database queries for the big segment state of any given user will be done less often, but that changes to segment membership may not be detected as soon.

If not specified, the default value is 5. Negative values are changed to the default.

Generated using TypeDoc