How to get byte[] data

Topics: Developer Forum
Feb 18, 2008 at 4:27 AM
I cached my byte[] data
byte[] data = LoadData();
IndexusDistributionCache.SharedCache.Add("test", data);

I want go get my data:
byte[] t = (byte[])IndexusDistributionCache.SharedCache.Get("test");
byte[] t = IndexusDistributionCache.SharedCache.Get<byte[]>("test");

But bouth of above were wrong.

Please tell me how do it ?
Feb 18, 2008 at 10:31 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 18, 2008 at 6:41 PM
The test application provides from version 2.0.0142 the test case 560 (this version is going to be available within the next few hours)

this option add and get serveral primitiv type also like byte[]

here the extract from the test application:
			string dataToSend = "indeXus.Net Shared Cache as byte array";
			byte[] valueByteArray = System.Text.Encoding.UTF8.GetBytes(dataToSend);
			Console.WriteLine("Handling byte value ({0})", valueByteArray);
			Common.Util.CacheAdd(keyByteArray, valueByteArray);
			byte[] keyByteArrayValue = Common.Util.CacheGet<byte[]>(keyByteArray);
			if (keyByteArrayValue == null)
				Console.WriteLine("could not read '{0}' from cache!!!!", valueByteArray);
				Console.WriteLine("Sent and Received Data:\nS:'{0}'\nR:'{1}'", dataToSend, System.Text.Encoding.UTF8.GetString(keyByteArrayValue));