The value that I'm trying to append to is a string. I've been able to convert the string to a byte array using Encoding.ASCII.GetBytes(value)
and passing that to the IMemcachedClient
:
Appending to Memcached (seems fine)
var value = "Some string value that should get appended";
var bytes = Encoding.ASCII.GetBytes(value);
_memcachedClient.Append(key, new ArraySegment<byte>(bytes, 0, bytes.Length));
Getting appended value from Memcached
var valueAsBase64 = _memcachedClient.Get(key) as string;
var bytes = System.Convert.FromBase64String(valueAsBase64);
var result = Encoding.ASCII.GetString(bytes);
I see the value returned, and it's a string. I'm just not sure how to get the value returned back to the string I started off with (now appended).