Well, I just don't want it to fail. I want to put a value that will replace
the previous one and just return it (the previous one).

It can be something like:
repeat until success {
  Get previous value
  CheckAndPut(new value, previous value)
}
Then I know what I replaced by what.

The usecase is where someone wants to keep track of what has been modified.
A bit like a client side WAL. But they want that ONLY for updates. They
don't care about new inserts. And since there is 99% inserts and only 1%
updates, they don't want to just keep all puts.

JMS

Le lun. 25 mars 2019 à 15:16, Vladimir Rodionov <[email protected]> a
écrit :

> Interesting. If CheckAndPut succeeds, then you know the value and no need
> for Get, right?
> Only if it fail, you want to know current value if CheckAndPut fails?
> Can you elaborate on your use case, Jean-Marc?
>
> -Vlad
>
> On Mon, Mar 25, 2019 at 11:54 AM Jean-Marc Spaggiari <
> [email protected]> wrote:
>
> > Hi all,
> >
> > We have all CheckAndxxx operations, where we verify something and if the
> > condition is true we perform the operatoin (Put, Delete, Mutation, etc.).
> >
> > I'm looking for a GetAndPut operation. Where in a single atomic call, I
> can
> > get the actual value of a cell (if any), and perform the put. Working on
> a
> > usecase where this might help.
> >
> > Do we have anything like that? I can simulate by doing a Get then a
> > CheckAndPut, but that's 2 calls. Trying to save one call ;)
> >
> > Do we have anything like that?
> >
> > Thanks
> >
> > JMS
> >
>

Reply via email to