Course lesson 36 · Managing Workflows with Durable Objects

Durable Object API

One study unit · Read, recall, then practice · Original video 00:05:12

This lesson separates a Durable Object’s in-memory fields from its persistent storage and introduces the alarm API. A counter illustrates why a field alone is insufficient: when an inactive instance is restarted, memory must be rebuilt from stored data. The course begins with key-value storage for the scheduler and previews SQLite-backed objects for later live analytics.

Primary source: course video 36 · Supplied English subtitles · 00:05:12.

Understand the idea

What the course does

  1. Inspect the base class and constructor pattern used to access Durable Object capabilities.
  2. Consider an in-memory flag or counter and predict its value after the object is shut down.
  3. Compare this with a counter read from storage and written back after incrementing.
  4. Recognise the two storage approaches described: simple key-value access and SQLite tables.
  5. Inspect alarm scheduling using the current time plus a future interval.
  6. Connect the alarm callback to the later goal of starting a workflow with recovered click context.

Watch for

Recall before revealing

What must happen when a Durable Object wakes up if its last click context only existed in memory?

Reveal the explanation

That context cannot be recovered; it needed to be stored persistently and then loaded during reinitialisation.

Try it

Trace a counter through initialise, increment, write, shutdown, restart, and read. Write down both its memory and stored values after each event.

Check your result

Your trace preserves the increment across restart only when a storage write occurred and startup loaded that saved value.

Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.

Rewatch only what you need

Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.

Companion primary documentation: What are Durable Objects?. For recorded API names, commands, limits, and prices, check the version you use.

← Previous   Next →