kian
01/24/2023, 1:28 PMehesp
01/24/2023, 1:29 PMehesp
01/24/2023, 1:34 PMHardAtWork
01/24/2023, 1:40 PMJacob Wright
01/24/2023, 4:52 PMJacob Wright
01/24/2023, 4:54 PMHardAtWork
01/24/2023, 4:54 PMJacob Wright
01/24/2023, 4:54 PMJacob Wright
01/24/2023, 4:56 PMj_corea22454
01/24/2023, 4:57 PMj_corea22454
01/24/2023, 4:59 PMHardAtWork
01/24/2023, 4:59 PMj_corea22454
01/24/2023, 4:59 PMUnsmart | Tech debt
01/24/2023, 5:00 PMj_corea22454
01/24/2023, 5:21 PMjed
01/24/2023, 7:13 PMSkye
01/24/2023, 7:31 PMSkye
01/24/2023, 7:31 PMjed
01/24/2023, 8:34 PMhuw
01/25/2023, 5:38 AMLockface77
01/25/2023, 1:03 PMjavascript
async function handleRequest(request, env) {
let id = env.COUNTER.idFromName("A");
let obj = env.COUNTER.get(id);
let resp = await obj.fetch(request.url);
let count = await resp.text();
return new Response("Durable Object 'A' count: " + count);
}
Is it created like when you do env.COUNTER.get(id)?
If the object does not exist when we create the stub it is created and instanciated?
If yes, then I got another question, if the durable object that was created did not store anything inside of his storage does the object will still exist forever and will I have to pay anything?HardAtWork
01/25/2023, 1:06 PMLockface77
01/25/2023, 1:07 PMLockface77
01/25/2023, 1:09 PMjavascript
// Durable Object storage is automatically cached in-memory, so reading the
// same key every request is fast. (That said, you could also store the
// value in a class member if you prefer.)
But also for pricing:
Read request units 1 million, + $0.20/million
So if I am correct, for every time that I do:
javascript
await this.state.storage.get("value");
I am billed for 1 read request.
But actually if the data is cached in-memory during the read, am I still billed this amount?
Because otherwise, I could just store it myself in memory every time in order to save moneyHardAtWork
01/25/2023, 1:10 PMLockface77
01/25/2023, 1:13 PMjavascript
this.value = await this.state.storage.get("value");
I wont be billed if I access this.value (if the object is alive)HardAtWork
01/25/2023, 1:16 PMLockface77
01/25/2023, 1:16 PMmartinkallstrom
01/25/2023, 3:34 PMmartinkallstrom
01/25/2023, 3:39 PM