Skip to main content

Local caching

Stigg SDKs support local caching, which means that customer entitlements are stored in-memory to prevent network trips for subsequent entitlement access checks. It also makes our API redundant in the case it is unreachable for any reason (like a network outage), and the SDK can continue to evaluate access checks even when it’s offline. The local cache is invalidated by frequently polling for updates, or by listening to real-time updates delivered by a WebSocket streaming connection to our API (currently only available for the backend SDKs).

Fallback strategy

In the case where the entitlement local data is missing (for example: when a new feature was added to the codebase, but has still not been added to a plan) or our API is unreachable (for example: during a drop of internet connectivity), a fallback strategy can be configured using the Stigg SDKs.

Global fallback configuration

A global fallback strategy can be defined during the SDK initialization, for example:
When a fallback value is returned (for example, if Stigg is temporarily unreachable and the Sidecar reads from the configured fallback instead), the SDK response includes an indicator flag.
You can also monitor the following Sidecar metrics to detect fallback events:
  • sidecar_network_request_errors_total: counts failed requests to Stigg
  • sidecar_cache_misses_total: counts cache misses that lead to fallback usage

Entitlement-check fallback configuration

A fallback can also be defined during an entitlement check. When defined, entitlement-check fallbacks will override the global fallback configuration for the specific feature. For example:

Metering usage when there is no internet connectivity

While the entitlements checks continue to work in offline mode, usage metering is postponed until the SDK will become online again. During that period, usage measurements are buffered in-memory and will not be counted as actual usage before they’re sent and reach Stigg servers. In case of a long-term outage, the measurements can be stored in a persistent cache (if provided) to avoid data loss if the process will crash while the SDK is offline.