Working with Cas
hello,
I have a simple test app to test out membase and to see how to work with it
I want to keep a list of all my users' ids, so I've defined this in my page_load
casUsers = mc.Cas(Enyim.Caching.Memcached.StoreMode.Add, "AllUsers", string.Empty);
the way I understand it is that if the key doesn't exist , it will create it
and if it does it will give me it's latest Cas
and when I add a user through the gui:
casUsers = mc.Append("AllUsers", casUsers, new ArraySegment (Encoding.UTF8.GetBytes(sUsrIDToAppend)));
now.. this works , but it also works when instead of casUsers i pass the number 7 for example, or anything else..
what am I missing here?
thanks,
Igal
Hi Attila!
thanks for the quick response & fix !
I haven't had a chance to see if it works, because I'm having server issues
I have another question for you:
I want to implement a lock on one of my keys
according to this : http://www.couchbase.org/wiki/display/membase/Locking
I should use the 'add' & 'delete' commands to add a lock item
in your library add = Store with storemode.add?
and delete is Remove?
Yes.
Hi, as to your solution, I've checked it
now if I pass a literal value such as 7, the cas operation fails as it should
but if i pass a non-initialized casObj.Cas (0), or just 0 to it , it works despite the fact that this
key/value has been used before and had a Cas different than 0
thanks :)
igal
0 means 'no cas value', meaning the server ignores the cas
try ulong.MaxValue
cool , thanks :)
Hi,
Thanks for reporting this issue, it was a bug in the client's Append/Prepend implementation.
It's fixed now, and the source is available at https://github.com/enyim/EnyimMemcached/commit/16d9e644e228026574c11239f...
I've built you a beta version of the library, so you do not need to mess with git.
- https://www.dropbox.com/s/y4ctu93cyms7gwn/Enyim.Caching.2.10-14-g16d9e64...
- https://www.dropbox.com/s/owjnvok4hc7h6n7/Membase.2.13-14-g16d9e64.zip
(official builds wil be available later this week or early next week, depending on the feedback of some other testers)
Let me know if you run into any more issues.