Files

1.6 KiB

DO Storage Patterns

Persist essential state and treat memory as a reconstructible cache. Coordinate related updates within the storage and concurrency guarantees of the selected backend.

Fetch the relevant current documentation before implementing or reviewing changes.

Task Documentation
Schema initialization, migrations, indexes, caching, or parent-child coordination Rules of Durable Objects
Counters, transactions, and atomic updates SQLite storage API; Legacy KV storage API; Counter example
Batch processing or multiple scheduled events Alarms; Batching example
Cleanup and expiration Time to Live example; SQLite storage API
Design application-specific rate limiting Rules of Durable Objects; SQLite storage API

Verify persistence, isolation, and rollback behavior with the testing guidance.