I don't know much about this feature aside from a library in another language uses it and I'm trying to offload some work using crystal, but there's no current memcache libraries that support the check and set/compare and swap functionality for memcached.
This was something I found (ignore the site's name, it has a lot of important information at the beginning) along the way, but I've never worked with sockets or byte code much so I'm not even sure where to start.
Hopefully that helps someone with implementation of said feature.