According to this blog entry, you can run a storage.put
without await
, and it will store writes in a write cache and flush them to disk later.
Some questions:
A. If I update the same key, do I get charged for every write operation even though I may be actually just updating the write cache before it is flushed to disk (which is the expensive part)?
E.g:
storage.put("x", 1);
storage.put("x", 2);
storage.put("x", 3);
Am I charged for 3 writes here or 1?
B. Is the ordering of writes preserved regardless of await
? The blog mentions that you do not need await
on writes, but only shows writes in a block of all non-await or all await calls.
E.g:
storage.put("1", 1);
storage.put("1", 1.1);
storage.put("1", 1.3);
await storage.put("2", 2);
storage.put("3", 3);
await storage.put("4", 3);
Is the order of writes preserved here? I ask because an async
function typically implies the call to the function is concurrent, but I think put
orders the calls by when they were called.
Thanks