private static void ReverseFunction(IGearmanJob <byte[], byte[]> job) { var str = Encoding.ASCII.GetString(job.FunctionArgument); var strArray = str.ToCharArray(); Array.Reverse(strArray); var reversedStr = new string(strArray); job.Complete(Encoding.ASCII.GetBytes(reversedStr)); }
public void GetOembedsFunction(IGearmanJob <IList <string>, IList <OEmbed> > job) { var urls = job.FunctionArgument; var oembeds = new List <OEmbed>(); foreach (var url in urls) { // ... fetch oEmbeds ... } job.Complete(oembeds); }
public void GetOembedsFunction(IGearmanJob<IList<string>, IList<OEmbed>> job) { var urls = job.FunctionArgument; var oembeds = new List<OEmbed>(); foreach (var url in urls) { // ... fetch oEmbeds ... } job.Complete(oembeds); }
private static void DoReverse(IGearmanJob<string, string> job) { Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName); var str = job.FunctionArgument; var strArray = str.ToCharArray(); Array.Reverse(strArray); var reversedStr = new string(strArray); Console.WriteLine(" Reversed: {0}", reversedStr); job.Complete(reversedStr); }
private static void DoReverse(IGearmanJob <string, string> job) { Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName); var str = job.FunctionArgument; var strArray = str.ToCharArray(); Array.Reverse(strArray); var reversedStr = new string(strArray); Console.WriteLine(" Reversed: {0}", reversedStr); job.Complete(reversedStr); }
private static void DoReverseWithStatus(IGearmanJob<string, string> job) { Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName); var str = job.FunctionArgument; job.SetStatus(0, (uint)str.Length); var reversedArray = new char[str.Length]; for (int i = 0; i < str.Length; i++) { reversedArray[str.Length - i - 1] = str[i]; job.SetStatus((uint)i+1, (uint)str.Length); } var reversedStr = new string(reversedArray); Console.WriteLine(" Reversed: {0}", reversedStr); job.Complete(reversedStr); }
private static void DoReverseWithStatus(IGearmanJob <string, string> job) { Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName); var str = job.FunctionArgument; job.SetStatus(0, (uint)str.Length); var reversedArray = new char[str.Length]; for (int i = 0; i < str.Length; i++) { reversedArray[str.Length - i - 1] = str[i]; job.SetStatus((uint)i + 1, (uint)str.Length); } var reversedStr = new string(reversedArray); Console.WriteLine(" Reversed: {0}", reversedStr); job.Complete(reversedStr); }
private static void ReverseFunction(IGearmanJob<byte[], byte[]> job) { var str = Encoding.ASCII.GetString(job.FunctionArgument); var strArray = str.ToCharArray(); Array.Reverse(strArray); var reversedStr = new string(strArray); job.Complete(Encoding.ASCII.GetBytes(reversedStr)); }