I did a first pass at a client implementation in a branch at the
airport this morning or last night or whatever you call that. When I
get near a network I'll try to make it available to you to look at.
The only overhead is that I have to wrap the results in another
object to give you both parts. The call in the binary protocol is the
same (same for the actual CAS op... I didn't have to write much to get
it working in bin). In the text protocol, it's still not worth
worrying about.
I didn't do any type of bulk gets on the client interface, but the
aggregation part of the request optimization could do it for you. One
optimization that I intend to make here is to turn a series of mixed
get and gets requests into a single bulk gets on the text protocol.
This is unnecessary on the bin protocol because it's already the same
on the wire, so it just figures out whether you want the CAS ID or not
at the time of receiving a result.
--
Dustin Sallings (mobile)
On Feb 22, 2008, at 2:10, "Rakesh Rajan" <[EMAIL PROTECTED]> wrote:
Thanks for the reply! Are there any performance implication of using
a normal get v/s a get that also returns the unique cas number ?
Looking forward to CAS implementation in the client. Until then I
will stick to the current locking method for which I would love to
hear if there are any improvements that I could make.
-Rakesh
On Fri, Feb 22, 2008 at 3:31 AM, Dustin Sallings <[EMAIL PROTECTED]>
wrote:
On Feb 21, 2008, at 12:51, Rakesh Rajan wrote:
> I am currently using Dustin's Java library (memcached-2.0-pre7). I
> havn't seen any CAS function in that. So safely assuming that I need
> to continue to use java for my project ( :) ) , what are the
> alternatives that I have ?
>
> So from my understanding of CAS, I can pass a unique code, that I
> get from "get" operation, to the "set" operation. And in case it
> fails, I would need to fetch the latest value and update the cache
> entry again ( this would need to some kind of loop to make sure that
> I don't miss pushing any updates to cache).
Sorry, I've been a bit behind in my emails.
No, I never quite worked CAS support into my java client.
I've got a
long plane ride ahead of me tomorrow, so maybe that'll give me
something to do. :)
Basically, you do the get+set in a loop where the set fails if
something else mutated the value between the get and set.
--
Dustin Sallings