openkeyval
openkeyval copied to clipboard
When setting value, indicate whether key already existed in response
This would allow you to have something like a lock file that multiple clients could share.
Without knowing if the key already existed when writing, someone else could have written to the lock file in the time between you last checking if it existed, and writing to it.
Would this be useful?
Something like:
{ "status":"multiset", "keys":[ { "key":"testing1", "read_only_key":"rok-459f1694e2455461b1186749aaf3f949eba8a134", "new":"true" }, { "key":"testing2", "read_only_key":"rok-ee9efec3c53f048a34dba2b923ddbdaa8693aead", "new":"false" } ], "documentation_url":"http:\/\/openkeyval.org\/" }
Yes, this seems reasonable.
That would indeed be very useful. Alternatively, providing a way to write-if-not-exists, that could possibly be extended to write-unless-newer-than would bridge the gap as well.