C++ Server-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
lazy_load_builder.h File Reference
#include <launchdarkly/bindings/c/export.h>
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for lazy_load_builder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _LDServerLazyLoadBuilder * LDServerLazyLoadBuilder
 
typedef struct _LDServerLazyLoadSourcePtr * LDServerLazyLoadSourcePtr
 

Enumerations

enum  LDLazyLoadCacheEvictionPolicy { LD_LAZYLOAD_CACHE_EVICTION_POLICY_DISABLED = 0 }
 Specifies the action taken when a data item within the in-memory cache expires. More...
 

Functions

 LDServerLazyLoadBuilder_New ()
 
 LDServerLazyLoadBuilder_Free (LDServerLazyLoadBuilder b)
 Frees the memory associated with a Lazy Load builder. Do not call if the builder was consumed by the SDK config builder.
 
 LDServerLazyLoadBuilder_SourcePtr (LDServerLazyLoadBuilder b, LDServerLazyLoadSourcePtr source)
 
 LDServerLazyLoadBuilder_CacheRefreshMs (LDServerLazyLoadBuilder b, unsigned int milliseconds)
 Specify the duration data items should live in-memory before requiring a refresh via the database. The chosen LDLazyLoadCacheEvictionPolicy affects usage of this TTL.
 
 LDServerLazyLoadBuilder_CachePolicy (LDServerLazyLoadBuilder b, enum LDLazyLoadCacheEvictionPolicy policy)
 Specify the eviction policy when a data item's TTL expires. At this time, only LD_LAZYLOAD_CACHE_EVICTION_POLICY_DISABLED is supported (the default), which leaves stale items in the cache until they can be refreshed.
 

Enumeration Type Documentation

◆ LDLazyLoadCacheEvictionPolicy

Specifies the action taken when a data item within the in-memory cache expires.

At this time, the default policy is the only supported policy so there is no need to explicitely set it.

Function Documentation

◆ LDServerLazyLoadBuilder_CachePolicy()

LDServerLazyLoadBuilder_CachePolicy ( LDServerLazyLoadBuilder  b,
enum LDLazyLoadCacheEvictionPolicy  policy 
)

Specify the eviction policy when a data item's TTL expires. At this time, only LD_LAZYLOAD_CACHE_EVICTION_POLICY_DISABLED is supported (the default), which leaves stale items in the cache until they can be refreshed.

Parameters
bThe builder. Must not be NULL.
policyThe eviction policy.

◆ LDServerLazyLoadBuilder_CacheRefreshMs()

LDServerLazyLoadBuilder_CacheRefreshMs ( LDServerLazyLoadBuilder  b,
unsigned int  milliseconds 
)

Specify the duration data items should live in-memory before requiring a refresh via the database. The chosen LDLazyLoadCacheEvictionPolicy affects usage of this TTL.

Parameters
bThe builder. Must not be NULL.
millisecondsThe time-to-live for an item in milliseconds.

◆ LDServerLazyLoadBuilder_Free()

LDServerLazyLoadBuilder_Free ( LDServerLazyLoadBuilder  b)

Frees the memory associated with a Lazy Load builder. Do not call if the builder was consumed by the SDK config builder.

Parameters
bThe builder to free.

◆ LDServerLazyLoadBuilder_New()

LDServerLazyLoadBuilder_New ( )

Creates a Lazy Load builder which can be used as the SDK's data system.

In Lazy Load mode, the SDK will query a source for data as required, with an in-memory cache to reduce the number of queries. This enables usage of databases for storing feature flag/segment data.

In contrast, the Background Sync system injects data into the SDK asynchronously (either instantly as updates happen, in streaming mode; or periodically, in polling mode).

Background Sync mode is preferred for most use cases, but Lazy Load may be beneficial when no connection to LaunchDarkly is required, such as when using the Relay Proxy to populate a database.

◆ LDServerLazyLoadBuilder_SourcePtr()

LDServerLazyLoadBuilder_SourcePtr ( LDServerLazyLoadBuilder  b,
LDServerLazyLoadSourcePtr  source 
)

Configures the Lazy Load system with a source via opaque pointer to C++ ISerializedDataReader.

Parameters
bThe builder. Must not be NULL.
sourceThe source pointer. Behavior is undefined if the pointer is not an ISerializedDataReader. Must not be NULL.