ZoroXing / xmemcached

Automatically exported from code.google.com/p/xmemcached
Apache License 2.0
0 stars 0 forks source link

get after incr gives bad result #197

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
when I run the following:

client.client.incr("TESTINC", 1, 1, 10*1000l, 5);
Object obj = client.client.get("TESTINC");
System.out.println(obj.getClass());
System.out.println(obj);
System.out.println("STRING:" + obj.toString() + 
":END");            System.out.println(Long.parseLong(obj.toString()));

I get the output:

class java.lang.String
1
tring Object
STRING:1
tring Object
:END

the "tring Object" part is not always the same, seems to be pulling in extra 
bytes from somewhere else.

issuing additional incr on that key will fix the problem, but it happens 
universally on the first incr.

Original issue reported on code.google.com by dust...@gmail.com on 8 Jun 2012 at 6:41

GoogleCodeExporter commented 8 years ago
Please use string instead of integer as initial value for incr/decr.

client.client.incr("TESTINC", 1, "1", 10*1000l, 5);

Original comment by killme2...@gmail.com on 27 Jun 2012 at 3:27