15 ms·
The idempotency of PUT is supposedly useful with caching web proxies, but I don't know of any caching web proxies that support PUT. Are there any?
by ramen 16y ago
The idempotency of PUT is supposedly useful with caching web proxies, but I don't know of any caching web proxies that support PUT. Are there any?
- mjw 16y agoIt's not so much about caching - it's more about knowing that you're safely able to repeat a request which timed out or failed. A way to distinguish form submissions (like a credit card purchase form) which must not be repeated after submission, from things like "upload a new version of this file" which you can safely allow to be retried if they time out or fail. This is potentially useful for a bunch of different HTTP clients and client libraries, and potentially for some proxies too. Edit: actually PUT and DELETE are useful for caches - although not because of their idempotency, but just because they communicate the fact that the resource being PUT to or DELETEd may change as a result, hence the cache key for that URL should be purged. IIRC some caching proxies do do this.
- borisk 16y agoHehe, a proxy cashing PUTs can spice up your REST experience. How exactly will the proxy know someone else haven't updated a resource between 2 requests and it's safe not to pass the 2nd request to server?
- mjw 16y agoYep - it's not safe to assume you can cache a PUT in that way. AFAIK no caches do this. What they should do though is purge their cache for that URI when they see a successful PUT has happened.