http的幂等性及幂等性

幂等性方法定义:

9.1.2 Idempotent Methods

Methods can also have the property of “idempotence” in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and DELETE share this property. Also, the methods OPTIONS and TRACE SHOULD NOT have side effects, and so are inherently idempotent.
(幂等性有下面的属性:当操作次数N>0时,每次得到的结果是相同的,在http请求中GET, HEAD, PUT and DELETE 方法具有幂等性)

However, it is possible that a sequence of several requests is non- idempotent, even if all of the methods executed in that sequence are idempotent. (A sequence is idempotent if a single execution of the entire sequence always yields a result that is not changed by a reexecution of all, or part, of that sequence.) For example, a sequence is non-idempotent if its result depends on a value that is later modified in the same sequence.
(非幂等操作同样有重要的意义,比如说最终结果需要依赖一系列修改的时候)

A sequence that never has side effects is idempotent, by definition (provided that no concurrent operations are being executed on the same set of resources).
(如果一个操作不是负面影响的,就是幂等操作)比如:在http请求中get 操作,sql中的select操作都是幂等的,而http的put操作,sql的update操作都是非幂等的。

参考:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
http://www.cnblogs.com/weidagang2046/archive/2011/06/04/2063696.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值