amazon-web-servicesmemcachedamazon-elasticacheenyimenyim.caching

increment in memcache enyim cilient


I'm trying to figure out some basic operations in memcache.

I performed incr command on the telnet over memcache client node & it works fine. Now I'm trying the same in my C# code through enyim memcache client but i'm facing problem in this operation :-

I'm using following syntax

client.Increment("cc", 1, 1)

then it return response 0 & internally it is getting an error "Item not found".

But when i'm trying to set this value & incrementing then I'm getting an error "Non numeric objects can't be incremented/ decremented."

client.Store(StoreMode.Add, "cc", 1); Console.WriteLine(client.Increment("cc", 1, 1));

Now client.Store() always take an object as value So how can i achive increment/ decrement ?

I tried this syntax as well:-

client.Increment("VALUE", 10UL, 24UL)) but doesn't work.


Solution

  • After wasting an hour i found a solution :- client.Store(StoreMode.Set, "VALUE", "100"); Console.WriteLine(client.Increment("VALUE", 0, 1)); Console.WriteLine(client.Decrement("VALUE", 0, 1)); I was getting this stupid error bcoz of this ambiguous syntax.