patterns.md

Created about 12 hours ago

attributes
source_pathreferences/hyperdrive/patterns.md
source_sha25647ead78cd1b86acc52194de4cf94b7e6297cd74fdc33797275353fc8b2d9677c
source_urlhttps://github.com/cloudflare/skills/blob/47dfc2ce969bf62acf8bc231198ade4bb02712e0/skills/cloudflare/references/hyperdrive/patterns.md
supporting_skill_id40184
upstream_revision47dfc2ce969bf62acf8bc231198ade4bb02712e0

Hyperdrive design patterns

See api.md for maintained driver and ORM examples. Use the following decisions to select a pattern, then fetch its linked documentation for implementation.

Workload or decision Guidance and documentation
Popular content or analytics dashboards Cache only when the product can tolerate the configured stale window. Use query caching for eligibility, parameters, and settings.
Mixed cached reads and fresh reads Route authentication, permissions, and reads after writes through a cache-disabled configuration. Writes do not invalidate cached results; see read-after-write behavior.
Multi-tenant queries Derive tenant scope from authenticated application context and apply it to every query. A cache is not an authorization boundary. Review query caching for the selected query's behavior.
Globally distributed callers Understand the distinction between fast connection setup and the remaining query round trip in how Hyperdrive works.
Multiple sequential database queries For one regional database, configure an explicit region hint using placement setup. Compare deployed request duration and Hyperdrive metrics with representative cache behavior.
Transactions or connection-local state Keep transactions short and do not assume state survives across transactions. Fetch connection pooling and supported features before relying on session settings.
Client lifetime and pool sizing Create clients per handler invocation; Hyperdrive owns the origin pool. Use connection lifecycle and pool tuning instead of a global driver pool or copied connection counts.

Separate application correctness from acceleration: use parameterized queries, enforce tenant access in the application, and select freshness before tuning cache hit rate. See gotchas.md when observed behavior differs from the design.

Children

No children yet.

Like how this is organised?

Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.