Reputation: 2814
I haven't been able to find many decent examples of how to use AWS Elasticache from c#.
http://jacace.wordpress.com/2013/02/24/using-the-amazon-elasticache-in-c/ suggested the BeIT library, which I am trying.
Here's my code so far:
string memCachedUrl = "mycache.xxxxxx.cfg.use1.cache.amazonaws.com:11211";
MemcachedClient.Setup("mycache", new string[] { memCachedUrl });
MemcachedClient cache = MemcachedClient.GetInstance("mycache");
aData n = new aData();
cache.Set("aData",1234);
and the error I get is:
29/05/2013 9:52:19 AM ERROR BeIT.MemCached.SocketPool - Error connecting to: 54.
243.16.75
The operation completed successfully
at BeIT.MemCached.PooledSocket..ctor(SocketPool socketPool, IPEndPoint endPoint, Int32 endReceiveTimeout, Int32 connectTimeout) in l:\Projects\BeITMemcached
\ClientLibrary\PooledSocket.cs:line 63
at BeIT.MemCached.SocketPool.Acquire() in l:\Projects\BeITMemcached\ClientLibrary\SocketPool.cs:line 151
what am I doing wrong? Is there any good sample c# code anywhere?
UPDATE
I was trying to call this from outside AWS - apparently this is not possible
Upvotes: 0
Views: 1521
Reputation: 81
If the reason to do this is for testing purposes, the service discovery piece is pretty easy to fake. Make an http listener that responds to "config get" with info describing a local Memcached node.
Easy to see what the client is doing: https://github.com/awslabs/elasticache-cluster-config-net Amazon.ElastiCacheCluster/Operations/ConfigGetOperation.cs
Upvotes: 1
Reputation: 264
I realize this is an older question however I had issues and could not find good examples of how to successfully implement ElastiCache with Memcached flavor in my C# application so I built a library that you can easily use for yours. I hope this helps someone out.
One thing to reiterate as you have already stated is that you cannot access your nodes outside of Amazon.
Upvotes: 1