I was unable to find a good memcached tutorial on Amazon Cloudand. I am very new to this caching. I am trying to use memcached through the Amazon ElastiCache service and using the spymemcached client to actually make memcached calls.
Here is what I am doing now in Java:
try { ConnectionFactoryBuilder connectionFactoryBuilder = new ConnectionFactoryBuilder(); MemcachedClient memcachedClient = new MemcachedClient( connectionFactoryBuilder.build(), AddrUtil.getAddresses("<beginning of cache node end point grabbed from AWS Console>.cache.amazonaws.com:11211")); memcachedClient.set("test", 12, new Integer(12)); System.out.println(memcachedClient.get("test")); } catch (IOException ioException) { ioException.printStackTrace(); }
The error I get when trying:
java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:414) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:278) at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1981) 2012-02-01 19:25:35.415 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=<node endpoint>.cache.amazonaws.com/184.73.64.56:11211,
Anyone have any ideas or experience? Thanks!
Craig
source share