Skip to main content
The SDK keeps a single in-memory snapshot of all configs, secrets and flags. Every read returns from that snapshot, and reads never block on the network.

Network hits

One snapshot, shared by every clone

Reads take a short lock, clone the value and release it. A sync replaces the whole snapshot in one assignment, so a reader sees either the old or the new state, never a mixture. The lock is never held across an .await, and a panic elsewhere in the process cannot poison it into a permanently unusable client.

Coalesced refreshes

Syncs are serialised. A burst of triggers - fifty concurrent reads on a stale snapshot, an SSE event storm, a TTL tick landing on top of both - produces one request at a time, so:
  • the SDK never opens a request per read,
  • an older response can never overwrite a newer snapshot.

ETag / 304 Not Modified

The ETag from each 200 response is stored and sent back as If-None-Match. On 304:
  • the snapshot is not replaced,
  • synced_at is updated, so the TTL clock resets,
  • the billing and quarantine states are cleared.

Bounded bodies

Every response the SDK parses has a size cap - 8 MiB for sync and AB evaluation, 1 MiB for the token exchange, 64 KiB for metadata. Exceeding it raises ResponseTooLarge; a truncated document is never handed to the parser.

Failure behaviour

On any non-2xx / non-304 response the SDK never clears the cache - reads keep serving the last known-good snapshot. In addition:

With SSE active

Every event triggers a sync, so the cache is usually fresher than the TTL requires. The TTL timer keeps running as a fallback at exactly the interval you configured.

Cleanup

close() does the same at a point you choose, and is idempotent. Dropping an individual clone does nothing - the shared state stays alive for the others. std::process::exit skips destructors, so call close() if you exit that way and want the file secrets gone immediately. The SDK deliberately installs no signal handlers: a library that did would silently change how your application responds to Ctrl-C.

Diagnostics

Install a tracing subscriber to see each sync, its outcome and the counts it applied: