Esempio n. 1
0
    public static object HMSet(string[] args)
    {
        string key = args[0].Trim('"');                                      //Get first param which should be the key

        args = args.Skip(1).Take(args.Count() - 1).ToArray();                //Skip the key and leave the pairs left
        Dictionary <string, string> map = new Dictionary <string, string>(); //Make the map with 0 because we concat it later
        bool   error        = false;
        string errorMessage = "";

        args.ToList().ForEach(x =>
        {
            List <string> input = SQFUtil.ParamParse(x);
            if (input.Count % 2 != 0)
            {
                errorMessage = "ERROR: Not even number of parameters"; error = true; return;
            }
            ;
            SQFUtil.ParamParse(input).ToList().ForEach(y => map.Add(y.Key, y.Value));
        });
        if (error)
        {
            return(errorMessage);
        }                                     //Don't set anything if the values are wrong
        RedisController.RedisHMSet(key, map); //Set the values to the database
        return(0);
    }
Esempio n. 2
0
 public static string ZRangeByScore(string[] args)
 {
     string[] output = null;
     if (args.Length == 8)
     {
         output = RedisController.RedisZRangeByScore(args[0], double.Parse(args[1]), double.Parse(args[2]), bool.Parse(args[3]), bool.Parse(args[4]), bool.Parse(args[5]), long.Parse(args[6]), long.Parse(args[7]));
     }
     else if (args.Length == 7)
     {
         output = RedisController.RedisZRangeByScore(args[0], double.Parse(args[1]), double.Parse(args[2]), bool.Parse(args[3]), bool.Parse(args[4]), bool.Parse(args[5]), long.Parse(args[6]));
     }
     else if (args.Length == 6)
     {
         output = RedisController.RedisZRangeByScore(args[0], double.Parse(args[1]), double.Parse(args[2]), bool.Parse(args[3]), bool.Parse(args[4]), bool.Parse(args[5]));
     }
     else if (args.Length == 5)
     {
         output = RedisController.RedisZRangeByScore(args[0], double.Parse(args[1]), double.Parse(args[2]), bool.Parse(args[3]), bool.Parse(args[4]));
     }
     else if (args.Length == 4)
     {
         output = RedisController.RedisZRangeByScore(args[0], double.Parse(args[1]), double.Parse(args[2]), bool.Parse(args[3]));
     }
     else
     {
         output = RedisController.RedisZRangeByScore(args[0], double.Parse(args[1]), double.Parse(args[2]));
     }
     return(SQFUtil.SQFConvert(output));
 }
Esempio n. 3
0
    public static int RvExtension(StringBuilder output, int outputSize,
                                  [MarshalAs(UnmanagedType.LPStr)] string function)
    {
        switch (function)
        {
        case "Connect":
            bool Connection = RedisController.RedisConnect();
            if (Connection)
            {
                output.Append("Connected");
                return(0);
            }
            else
            {
                output.Append(RedisController.ErrorMessage);
                return(1);
            }

        case "Scan":
            if (RedisController.Connected)
            {
                output.Append(SQFUtil.SQFConvert(RedisController.RedisScan()));
            }
            return(0);

        case "Version":
            output.Append(Version);
            break;
        }
        return(0);
    }
Esempio n. 4
0
 public static string ZRange(string[] args)
 {
     string[] output = null;
     if (args.Length == 4)
     {
         output = RedisController.RedisZRange(args[0], long.Parse(args[1]), long.Parse(args[2]), bool.Parse(args[3]));
     }
     else
     {
         output = RedisController.RedisZRange(args[0], long.Parse(args[1]), long.Parse(args[2]));
     }
     return(SQFUtil.SQFConvert(output));
 }
Esempio n. 5
0
 public static string Scan(string[] args)
 {
     string[] output = null;
     if (args.Length == 2)
     {
         output = RedisController.RedisScan(int.Parse(args[0]), args[1]);
     }
     else if (args.Length == 3)
     {
         output = RedisController.RedisScan(int.Parse(args[0]), args[1], long.Parse(args[2]));
     }
     else
     {
         output = RedisController.RedisScan(int.Parse(args[0]));
     }
     return(SQFUtil.SQFConvert(output));
 }
Esempio n. 6
0
 public static string ZScan(string[] args)
 {
     Tuple <string, double>[] tuples = null;
     if (args.Length == 4)
     {
         tuples = RedisController.RedisZScan(args[0], int.Parse(args[1]), args[2], long.Parse(args[4]));
     }
     else if (args.Length == 3)
     {
         tuples = RedisController.RedisZScan(args[0], int.Parse(args[1]), args[2]);
     }
     else
     {
         tuples = RedisController.RedisZScan(args[0], int.Parse(args[1]));
     }
     return(SQFUtil.SQFConvert(tuples.ToDictionary(x => x.Item1, x => x.Item2.ToString()), false));
 }
Esempio n. 7
0
 public static object HScan(string[] args)
 {
     if (args.Length < 2)
     {
         return(0);
     }                                  //Min of 2 args
     Tuple <string, string>[] scan = null;
     if (args.Length == 4)
     {
         scan = RedisController.RedisHScan(args[0].Trim('"'), int.Parse(args[1].Trim('"')), args[2].Trim('"'), int.Parse(args[3]));
     }
     else if (args.Length == 3)
     {
         scan = RedisController.RedisHScan(args[0].Trim('"'), int.Parse(args[1].Trim('"')), args[2].Trim('"'));
     }
     else
     {
         scan = RedisController.RedisHScan(args[0].Trim('"'), int.Parse(args[1].Trim('"')));
     }
     return(SQFUtil.SQFConvert(scan.ToDictionary(x => x.Item1, x => x.Item2)));
 }
Esempio n. 8
0
 public static string Keys(string[] args)
 {
     return(SQFUtil.SQFConvert(RedisController.RedisKeys(args[0])));
 }
Esempio n. 9
0
 public static void HDel(string[] args)
 {
     RedisController.RedisHDel(args[0], SQFUtil.ParamParse(args[1]).ToArray());
 }
Esempio n. 10
0
 public static void PFMerge(string[] args)
 {
     RedisController.RedisPfMerge(args[0], SQFUtil.ParamParse(args[1]).ToArray());
 }
Esempio n. 11
0
 public static void SRem(string[] args)
 {
     RedisController.RedisSRem(args[0], SQFUtil.ParamParse(args[1]));
 }
Esempio n. 12
0
 public static void RPush(string[] args)
 {
     RedisController.RedisRPush(args[0], SQFUtil.ParamParse(args[1]));
 }
Esempio n. 13
0
 public static void BRPop(string[] args)
 {
     RedisController.RedisBRPop(int.Parse(args[0]), SQFUtil.ParamParse(args[1]).ToArray());
 }
Esempio n. 14
0
 public static string LRange(string[] args)
 {
     return(SQFUtil.SQFConvert(RedisController.RedisLRange(args[0], long.Parse(args[1]), long.Parse(args[2]))));
 }
Esempio n. 15
0
 public static void MSetNx(string[] args)
 {
     RedisController.RedisMSetNx(SQFUtil.ParamParse(args[0]).ToArray());
 }
Esempio n. 16
0
 public static string MGet(string[] args)
 {
     return(SQFUtil.SQFConvert(RedisController.RedisMGet(args)));
 }
Esempio n. 17
0
 public static string SMembers(string[] args)
 {
     return(SQFUtil.SQFConvert(RedisController.RedisSMembers(args[0]), false));
 }
Esempio n. 18
0
 public static void PFAdd(string[] args)
 {
     RedisController.RedisPfAdd(args[0], SQFUtil.ParamParse(args[1]));
 }
Esempio n. 19
0
 public static string HGetAll(string[] args)
 {
     return(SQFUtil.SQFConvert(RedisController.RedisHGetAll(args[0].Trim('"'))));
 }