`The server stores the key and the purpose of the request in a backend database. `
If the purpose is to make the system idempotent and the key has to be deleted after transaction is processed (either success or failure), it's better to store this unique/random ID in cache.
As long as the key is present in cache, we can check for duplicate transaction and straightaway invalidate the request.
How do you build operation of generating and serving transaction key as an idempotent operation?
`The server stores the key and the purpose of the request in a backend database. `
If the purpose is to make the system idempotent and the key has to be deleted after transaction is processed (either success or failure), it's better to store this unique/random ID in cache.
As long as the key is present in cache, we can check for duplicate transaction and straightaway invalidate the request.