Question

I'm actually trying to get the protobuf-net transcoder going, but before I can do that I need to get enyim/memcached setup working, and with the scant documentation available, I'm having trouble. Here's my simple .net test:

using Enyim.Caching;
using Enyim.Caching.Memcached;
....

MemcachedClient Cache = new MemcachedClient();
string key = "somekey";
string objectToCache = "someval";
Cache.Store(StoreMode.Set, key, objectToCache, DateTime.Now.AddMinutes(1000000));
string test = Cache.Get(key) as string; //...it's null though

My memcached server package 1.4.14 (x64) is here and seems to run fine as a Windows service, and I am using the latest nuget packages for enyim and protobuf, but (even with transcoding turned off, so pure enyim/memcached) no luck. Then, again using the nuget package EnyimMemcached-log4net to try to turn on log4net via my web.config as instructed here, I get this error:

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821

...which appears to be nuget returning the wrong version of log4net (project reference says 1.2.11), even though it's handling the dependencies itself. So I can't even see why enyim is failing to store/get.

What are the correct steps to get this working?

EDIT: By commenting out any reference to duration, it works (including transcoding).

Cache.Store(StoreMode.Set, key, objectToCache); //, DateTime.Now.AddMinutes(1000000));

So, to modify the original question slightly: Is there something wrong with using expiresAt? And is there a simple way to get log4net working in the current enyim incarnation?

Was it helpful?

Solution

The answer appears to be a bad build of memcached, see this question. I can't confirm that, because the couchbase d/l of 1.4.5 doesn't run as a proper Windows service (as my caching layer must).

As far as the log4net/enyim versioning, updating the nuget package manager when prompted via VS extension manager seems to have resolved it, though I never isolated the cause.

OTHER TIPS

I had the "Could not load file or assembly 'log4net, Version=1.2.10.0" error as well.

In my case it turned out; 'EnyimMemcached-log4net' NuGet package required 1.2.10.0 version of the 'log4net', even though it wasn't specifically mentioned in the dependencies. Installing the required log4net package solved it for me.

Install-Package log4net -version 1.2.10.0
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top