Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

When setting value, indicate whether key already existed in response #19

Open
johtso opened this issue Jun 12, 2011 · 2 comments
Open

Comments

@johtso
Copy link

johtso commented Jun 12, 2011

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\/"
}
@dustball
Copy link
Collaborator

Yes, this seems reasonable.

@RomainMuller
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants