示例#1
0
 private static string ParseStream(Stream stream)
 {
     string[] result = RedisReader.ReadMultiBulkUTF8(stream);
     if (result == null)
     {
         return(null);
     }
     return(result[1]);
 }
示例#2
0
 protected static Tuple <string, string> ParseStream(Stream stream)
 {
     string[] result = RedisReader.ReadMultiBulkUTF8(stream);
     if (result == null)
     {
         return(null);
     }
     return(Tuple.Create(result[0], result[1]));
 }
示例#3
0
        private static DateTime ParseStream(Stream stream)
        {
            string[] parts        = RedisReader.ReadMultiBulkUTF8(stream);
            int      timestamp    = Int32.Parse(parts[0]);
            int      microseconds = Int32.Parse(parts[1]);
            long     ticks        = microseconds * (TimeSpan.TicksPerMillisecond / 1000);

            return(RedisArgs.Epoch
                   + TimeSpan.FromSeconds(timestamp)
                   + TimeSpan.FromTicks(ticks));
        }
示例#4
0
        private static Dictionary <string, string>[] ParseStream(Stream stream, string[] fields)
        {
            string[] response = RedisReader.ReadMultiBulkUTF8(stream);

            Dictionary <string, string>[] dicts = new Dictionary <string, string> [response.Length / fields.Length];
            for (int i = 0; i < response.Length; i += fields.Length)
            {
                dicts[i / fields.Length] = new Dictionary <string, string>();
                for (int j = 0; j < fields.Length; j++)
                {
                    dicts[i / fields.Length][fields[j]] = response[i + j];
                }
            }
            return(dicts);
        }
示例#5
0
 private static Dictionary <string, string> ParseStream(Stream stream)
 {
     string[] fieldValues = RedisReader.ReadMultiBulkUTF8(stream);
     return(HashMapper.ToDict(fieldValues));
 }