You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section describes the lifecycle of a [Durable Object](/durable-objects/concepts/what-are-durable-objects/).
11
11
12
12
To use a Durable Object you need to create a [Durable Object Stub](/durable-objects/api/stub/).
13
-
By just creating the Durable Object Stub no request is yet sent to the Durable Object, thus the Durable Object is not yet instantiated.
14
-
Only once a method is invoked on the Durable Object Stub a request is actually sent to the Durable Object and its lifecycle begins.
13
+
Simply creating the Durable Object Stub does not send a request to the Durable Object, and therefore the Durable Object is not yet instantiated.
14
+
A request is sent to the Durable Object and its lifecycle begins only once a method is invoked on the Durable Object Stub.
15
15
16
-
```javascript
16
+
```js
17
17
constid=env.MY_DURABLE_OBJECT.idFromName("foo");
18
18
conststub=env.MY_DURABLE_OBJECT.get(id);
19
19
// Now the request is sent to the remote Durable Object.
@@ -51,7 +51,7 @@ Hibernation can only occur if **all** of the conditions below are true:
51
51
- No WebSocket standard API is used.
52
52
- No request/event is still being processed, because hibernating would mean losing track of the async function which is eventually supposed to return a response to that request.
53
53
54
-
After 10 seconds of no incoming request or event and all the above conditions satisfied, the Durable Object will transition into the **hibernated** state.
54
+
After 10 seconds of no incoming request or event, and all the above conditions satisfied, the Durable Object will transition into the **hibernated** state.
55
55
56
56
:::caution
57
57
When hibernated, the in-memory state is discarded, so ensure you persist all important information in the Durable Object's storage.
Copy file name to clipboardExpand all lines: src/content/partials/durable-objects/do-faq-pricing.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
### When does a Durable Object incur duration charges?
6
6
7
-
A Durable Object incurs duration charges as long as the JavaScript object has to be in memory, either because it's actively handling a request or because it cannot hibernate.
7
+
A Durable Object incurs duration charges as long as the JavaScript object has to be in memory, either because it is actively handling a request, or because it cannot hibernate.
8
8
9
9
Once an object has been evicted from memory, the next time it is needed, it will be recreated (calling the constructor again).
0 commit comments