Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ from reflag import Client

with Client() as client:
flags = client.bind({"user": {"id": "user-123"}, "company": {"id": "company-123"}})
enabled = flags.get_flag("my-flag", default=False)
enabled = flags.get_flag("my-flag")
settings = flags.get_flag("settings", default={"theme": "light"})
```

Replace the flag keys and IDs with your own. Reuse one client per application worker;
initialization loads definitions, and subsequent flag reads are local and in-memory.
Omitting `default` is equivalent to `default=False` and returns a `bool`.

Replace the flag keys and IDs with your own.

Create and initialize **one client per application worker** at startup, reuse it
across requests, and close it at shutdown. Do not create a new client for each request
or flag check. Use `client.bind(...)` for request-specific user/company context.
Initialization loads definitions; subsequent flag reads are local and in-memory.

For async applications, use `async with AsyncClient()` in the application lifespan.
Flag reads remain synchronous: do **not** await `get_flag()`.
Expand Down
Loading