leeoo / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

.get(key) returns null #275

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
spymemcached-2.8.4, 
memcached 1.4.15
Linux
===
MemcachedClient memc = new  
MemcachedClient(AddrUtil.getAddresses("127.0.0.1:11211"));
String key = "00a8d7a51e0b0b1fda0b36eff8f9dc22";
Object memcHash = memc.get(key);

getLogger().info("got from memcache: ------>" + memcHash );
===
in logs always null:
got from memcache: ------>null

in 'memcached -vv' logs I can see that this key exists and was sent:

===
<36 new auto-negotiating client connection
36: Client using the ascii protocol
<36 get 00a8d7a51e0b0b1fda0b36eff8f9dc22
> FOUND KEY 00a8d7a51e0b0b1fda0b36eff8f9dc22
>36 sending key 00a8d7a51e0b0b1fda0b36eff8f9dc22
>36 END
===

What am I doing wrong?

Original issue reported on code.google.com by odware...@gmail.com on 1 May 2013 at 1:04

GoogleCodeExporter commented 9 years ago
When I try 'set' in my coge and then get  - I receive the data. When I try put 
data from php and get this key from telnet - I receive the data (this is json 
string in UTF-8 encoding),  but when i try to get from java - i receive null.

Original comment by odware...@gmail.com on 27 May 2013 at 3:51

GoogleCodeExporter commented 9 years ago
After I replace the data (mc.set("mykey",3600,"111")), then it reads 
successfully.

Original comment by odware...@gmail.com on 27 May 2013 at 5:14

GoogleCodeExporter commented 9 years ago
Hi,

yes - this is somewhat expected. You are running into the problem that 
different clients use different flags for this. I dont know which drivers you 
use on the PHP side, but you need to make sure to use the same flags for both 
data - or just use no flags at all on both sides.

I recommend you to watch this hangout from some couchbase devs that cover 
interoperability - and this directly translates to memcache as well! 
http://www.youtube.com/watch?v=-FWCPGKw2RI&feature=plcp

Original comment by michael....@gmail.com on 28 May 2013 at 6:13