# 【译文】什么是幂等

（原文是一个视频的文字记录版，有兴趣的可以看原文和原文中的视频，本文只翻译文字并结合自己的一些理解做一些整理。）

### 为什么幂等很重要？

Email 实际上十一个很好的例子，因为同一封邮件你不想发送两次。让我们假设我们有一个邮件服务并且通过它发送一个消息：“请将这封邮件发送给我的客户”。你没有得到任何反馈，你将会怎么做？发生了什么？你会尝试重新发送吗？如果邮件已经发送了呢？再发一次相同的邮件？如果不重新发送客户将无法收到收件。

“我不知道这是否行得通，但是我将会再试一次。”这将是你系统中非常好的属性。

### 如何实现幂等？

ID 可能用在多个地方。用在一个请求上：“我们需要电梯向上到三层因为我们知道那个按钮和它的意义”。也可以是：“我已经发送过了到三层电梯的信号，我不需要再次发送。”。

### 总结

Do yourselves a favor and look for some services that need to happen exactly once. Could be something like sending an email. Could be writing a message to a log. Could be some user setting in your user-panel, and wrap them in something like a data structure that makes them idempotent.

Do me a favor please and share this with friends. If you found it valuable, they might find it valuable, too. Also, if you found it valuable, you probably want to subscribe. That way you’ll get all of the other new episodes as they come out. You won’t miss that value that you have already discovered.

I like to be in deep discussions with smart people. Please email me. I’m [email protected] or get in a discussion on Twitter. I try to use Twitter as a discussion medium. I’m @ericnormand with a D there.

Also, you can find me on LinkedIn. I’m trying to get better at LinkedIn. It’s a little hard for me. If that’s where you like to connect, let’s connect and start having a conversation.

All right. See you later.