Enyim .Net Library Problems
This has been mentioned [URL=http://forums.membase.com/showthread.php?209-Any-plans-for-a-supported-.Net-Membase-client&p=717&viewfull=1#post717]here[/URL] but I think it deserves it's own thread.
We have also encountered issues with the increment / decrement features of the Enyim lib:
[CODE]Assert.AreEqual(1UL, cache.Increment(key, 1UL, 1UL), "Non-exsiting value should be set to default");
Assert.AreEqual(1UL, cache.Get(key), "Cache should contain value");[/CODE]
The second Assert fails as cache.Get(key) returns NULL.
This happens on a single local instance of windows 7 (x64) based Membase memcache server (v 1.0.3) and using the latest Enyim lib (v 2.2).
I am able to successfully increment and decrement a key using:
var nsClient = new NorthScaleClient();
nsClient.Store(StoreMode.Set, "test", "1");
nsClient.Increment("test",0,1);
var nsClient = new NorthScaleClient();
nsClient.Store(StoreMode.Set, "test", "1");
nsClient.Increment("test",0,1);
Sure but you shouldn't need to Set the cache value before calling Increment. The Increment methods supports a default value which is used to initialise the value if it is not already in the cache.
Try this:
[CODE]var nsClient = new NorthScaleClient();
nsClient.FlushAll();
nsClient.Increment("test",1,1);
ulong expected = 1;
var actual = (ulong)nsClient.Get("test");
Assert.AreEqual(expected, actual);
nsClient.Increment("test",1,9);
ulong expected2 = 10;
var actual2 = (ulong)nsClient.Get("test");
Assert.AreEqual(expected2, actual2);[/CODE]
I haven't tested the above as the NorthScale [URL=http://forums.northscale.com/showthread.php?49-NorthScaleServer-Won-t-Start&p=790&posted=1#post790]has died again[/URL] and needs to be re-installed.
Marcus
Hmm, you are correct Marcus, I missed that in my first analysis.
I think it is working for me though...looking at the end value of the "test" key from running your code, it is set to 10.
I have since upgraded my Enyim client to the latest version, available here: [url]http://github.com/enyim/EnyimMemcached[/url].
Can you check with the newest version, and I will confirm whether a bug has been fixed?
Thanks!
Perry
Hi Perry,
Upgrading to NorthScale.Store.2.3.zip doesn't fix the problem. (BTW Enyim.Caching.dll in that download is sitll 2.2). Are you using the 2.3 binaries downloaded from [url]http://github.com/enyim/EnyimMemcached/downloads[/url] or are you pulling the source and recompiling?
The following Unit Test fails for me:
[CODE][TestMethod]
public void IncrementTest()
{
var nsClient = new NorthScaleClient();
nsClient.FlushAll();
nsClient.Increment("test", 1, 1);
ulong expected = 1;
var actual = nsClient.Get("test");
Assert.AreEqual(expected, (ulong)actual);
nsClient.Increment("test", 1, 9);
ulong expected2 = 10;
var actual2 = nsClient.Get("test");
Assert.AreEqual(expected2, (ulong)actual2);
}[/CODE]
var actual = nsClient.Get("test");
nsClient.Get("test") returns null when it should return 1
Marcus
Okay Marcus, I think I've found the bug here...it's definitely something within the client. If you actually look into the server (which is what I was doing initially) you'll see that the key is being set correctly and incremented correctly. There's something within the client that isn't processing the "Get" correctly after an increment has been used to set a key to a default value.
We'll look into this further and hopefully provide a fix as soon as possible.
Thanks for your patience, I'll get back in touch shortly.
Perry
Marcus, the increment issue is fixed in the latest update for the Enyim client. Can you please download NorthScale.Store version 2.4 and try it out?
Thanks much, hope that takes care of it.
Perry
What is the intial value you are setting the key to? Can you send some sample code of setting and incrementing the key that fails? I will try to reproduce this on our side as well.
Perry
Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Membase: http://www.membase.com/products-and-services/overview
Call or email "sales -at- membase -dot- com" today!