Is it possible to use KV for a nonce?

KV Workers seem to be a perfect solution for a nonce since they can self expire. I was worried about the write latency. I don’t want to start a request that writes a nonce and then an almost immediate subsequent request fail the nonce check because the nonce is not yet readable. Is this a legitimate concern and if so should I switch to Durable Objects instead? Can I rely on the nonce being available immediately for reading as long as it’s the same client making the request?


Yes, while a write will typically be available immediately within the same POP, and thus it will usually work, there is no assurance of this, nor any assurance that the client will actually hit the same POP. Durable Objects, which offer strong consistency, would be a better option.

Thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.