Vonetizer
Vonetizer

Reputation: 393

How do I append data to memcached using Enyim.Caching in C#?

I am trying to append data to memcached using C# Enyim.Caching but it forces me to send data as ArraySegment

public bool Append(string key, ArraySegment<byte> data);

How do I convert a string or array of strings to ArraySegment ?

Is there a better way to use Append?

Upvotes: 0

Views: 247

Answers (1)

Vonetizer
Vonetizer

Reputation: 393

I was able to find out how to do this. In order to convert a string to ArraySegment<byte> use the following code.

byte[] arrByte = Encoding.ASCII.GetBytes(data);
ArraySegment<byte> data = new ArraySegment<byte>(arrByte, 0, arrByte.Length);

Hope this helps someone!

Upvotes: 0

Related Questions