News for hackers. Stuff that matters.
Re:Volatile – A key-value pair API by lordgrenville on Tuesday November 12, 2019 @07:30AM (#21513519)
Could you expand on this? I've read your comment a couple of times and still don't quite understand. How is it idempotent?
Re:Volatile – A key-value pair API by quietbritishjim on Tuesday November 12, 2019 @08:06AM (#21513722)
Idempotent means that doing it once is the same as doing it more than once. This is standard terminology.

The parent comment uses "safe" to mean doing it zero times is the same as doing it once or more. This is not a definition I've heard before, but maybe it's common in this context. A more normal term would be "free of side effects".

Re:Volatile – A key-value pair API by jlokier on Tuesday November 12, 2019 @01:24PM (#21516592)
"Safe" and "idempotent" have defined meanings in the HTTP standards, that's why I used those terms, and provided the RFC section that explains for anyone who cares to read more.
Re:Volatile – A key-value pair API by 33degrees on Tuesday November 12, 2019 @08:03AM (#21513707)
Idempotent means that a given request always has the same result. This GET request fits that definition, since making the same request several times will always return the same thing. The fact that it modifies data means that it’s not safe, but that is a different concern. Remember that PUT and DELETE are also idempotent
Re:Volatile – A key-value pair API by michaelmior on Tuesday November 12, 2019 @09:32AM (#21514373)
Of course it's not just that it returns the same result, but that the request has the same effect. This is not entirely true since the modification date will change, but other than that it's true that setting a key to the same value multiple times is idempotent.
Re:Volatile – A key-value pair API by jlokier on Tuesday November 12, 2019 @01:46PM (#21516815)
If the modification date is changed, then its idempotency is open to application-specific definition.[1]

One way you might call modification time changes idempotent is if you don't care about modification times.

Another way is much subtler: Although an updated modification time represents a change, the point of HTTP idempotent requests is that repeating them automatically is harmless. This matters because some requests may be repeated automatically by some clients under some network conditions.[2] Updating the modification time twice to a near-current timestamp might satisfy the idempotency condition for the purposes of the application.

[1] This isn't as handwavy as it sounds. It means that because it's the application that determines whether the effects of a request count as "semantically" idempotent (or semantically safe), the application should choose the appropriate HTTP method (or "verb": GET, PUT, POST etc) for the application's needs. The application's choice of HTTP method matters because client libraries, proxies and servers perform different methods in different ways in the protocol.

[2] For example, if sent as the second or later request on a persistent HTTP/1.1 connection, just as the server closes the connection, then the client might retry any requests that are for an idempotent (or safe) method. So it may automatically retry GET, PUT and DELETE but not POST.

Re:Volatile – A key-value pair API by michaelmior on Tuesday November 12, 2019 @03:32PM (#21517830)
> One way you might call modification time changes idempotent is if you don't care about modification times.

My point exactly :)