Search code examples
javaspringmemcachedspymemcached

getting timeouts from spymemcached, using Spring integration


I'm trying to configure to use spymemcached to retrieve data from a memcached server (tried both 1.2 and 1.4). I configured it with the values provided in their wiki here (http://code.google.com/p/spymemcached/wiki/SpringIntegration). However, if I inject that bean as a MemcachedClient into my class, every time I try to access the cache I get a timeout. My line of code is as simple as that:

        MyClass object = (MyClass) memcachedClient.get(cacheKey);

at this moment the value is not in the cache, but I would expect it to return null. Instead, all I'm getting is a CXF exception (this is a webservice), in which the cause is:

Caused by: net.spy.memcached.OperationTimeoutException: Timeout waiting for value
  at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1003)
  at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1018)

No info in the logs (although I'm still trying to put them in DEBUG, as for now I see only spymemcached logs for INFO). Anyone had similar issues? I can access the memcached server via telnet and the get correctly returns END.

Thanks.


Solution

  • The problem was using the BINARY protocol. Switching to TEXT works fine. I guess the installed build of memcached didn't support this protocol - however it was not an easy catch!