I realize that Couchbase provides a client to their memcached server, but I'm trying to get the enyim.caching client to work.
Here's my trivial c# code that uses the Couchbase client (which works) and then pretty much the same thing with the enyim MemcachedClient:
class Program
{
static void Main(string[] args)
{
var client = new CouchbaseClient();
client.Store(StoreMode.Set, "somekey", "somevalue");
var somevalue = client.Get<string>("somekey");
Console.WriteLine(somevalue);
Console.ReadLine();
var mclient = new MemcachedClient();
mclient.Store(StoreMode.Set, "Hello", "World");
var myVal = mclient.Get<string>("Hello");
Console.WriteLine(myVal);
Console.ReadLine();
}
}
Here's my app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
<sectionGroup name="enyim.com">
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
</sectionGroup>
</configSections>
<couchbase>
<servers bucket="default" bucketPassword="myPassword">
<add uri="http://127.0.0.1:8091/pools"/>
</servers>
</couchbase>
<enyim.com>
<memcached>
<servers>
<add address="127.0.0.1" port="8091" />
</servers>
<socketPool minPoolSize="10" maxPoolSize="100" connectionTimeout="00:10:00" deadTimeout="00:02:00" />
<authentication type="Enyim.Caching.Memcached.PlainTextAuthenticator, Enyim.Caching" zone="" userName="Administrator" password="myPassword" />
</memcached>
</enyim.com>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
When I step through the code, the Couchbase client appears to work fine. The Get method returns "somevalue" as expected. The code also happily steps through the MemcachedClient code, but when I step through the Store method, it hangs for 10 seconds (I think that's the timeout) and then the myVal value returns as null. No errors are thrown.
I suspect the problem revolves around the zone
value in the authentication node for memcached in the config. In the DemoApp code that is in the enyim.caching source code (retrieved from Github), zone is never specified, but enyim throws an error if the zone isn't provided - i.e. the DemoApp doesn't work as is because zone isn't provided.
I'm not sure this is the problem, but I do know that I can't leave zone out, but I don't know what to use for that value. I've seen an example where 'AUTHZ' was used, but that doesn't seem to make any difference.
Does anyone see what I'm doing wrong here? Any help is appreciated! :)