Skip to content

docs(python): Include async flag cache providers#17066

Merged
dustinbyrne merged 3 commits into
masterfrom
docs/python-async-flag-cache-provider
Jun 5, 2026
Merged

docs(python): Include async flag cache providers#17066
dustinbyrne merged 3 commits into
masterfrom
docs/python-async-flag-cache-provider

Conversation

@dustinbyrne

Copy link
Copy Markdown
Contributor

Changes

  • Document that Python FlagDefinitionCacheProvider methods can return awaitables.
  • Add guidance for async clients such as redis.asyncio using the SDK-managed background event loop.
  • Link both sync and async Redis cache provider examples from the distributed environments guide.

Related SDK PR: PostHog/posthog-python#626

Checklist

  • I've read the docs and/or content style guides.
  • Words are spelled using American English
  • Use relative URLs for internal links
  • I've checked the pages added or changed in the Vercel preview build
  • If I moved a page, I added a redirect in vercel.json

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Deploy preview

Status Details Updated (UTC)
🟢 Ready View preview Jun 05, 2026 01:48PM

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Vale prose linter → found 0 errors, 1 warnings, 0 suggestions in your markdown

Full report → Copy the linter results into an LLM to batch-fix issues.

Linter being weird? Update the rules!

contents/docs/feature-flags/local-evaluation/_snippets/distributed-environments-common-patterns.mdx — 0 errors, 1 warnings, 0 suggestions
Line Severity Message Rule
34:71 warning Use 'PostHog' instead of 'posthog'. Vale.Terms

@dustinbyrne dustinbyrne force-pushed the docs/python-async-flag-cache-provider branch from 82c5a0a to bdff2c7 Compare May 27, 2026 17:04
@dustinbyrne dustinbyrne changed the title Document async Python flag cache providers docs(python): Include async flag cache providers May 28, 2026
@dustinbyrne dustinbyrne requested a review from a team May 28, 2026 13:52
Comment on lines +18 to +19
- [Synchronous Redis cache provider](https://github.com/PostHog/posthog-python/blob/master/examples/redis_flag_cache.py)
- [Async Redis cache provider](https://github.com/PostHog/posthog-python/blob/master/examples/async_redis_flag_cache.py) for async-first applications using `redis.asyncio`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets use a permlink instead

| `on_flag_definitions_received(data)` | Store definitions after a successful API fetch. | `None` or an awaitable resolving to `None` |
| `shutdown()` | Release locks, close connections, clean up resources. | `None` or an awaitable resolving to `None` |

> **Note:** All methods may throw errors. The SDK catches and logs them gracefully, ensuring cache provider errors never break flag evaluation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this pr but this is confusing
either the methods throw or not (unless the sdk catch and rethrow?)

@dustinbyrne dustinbyrne merged commit cae01dd into master Jun 5, 2026
18 checks passed
@dustinbyrne dustinbyrne deleted the docs/python-async-flag-cache-provider branch June 5, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants