You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Apewer.Source
  5. {
  6. internal class RedisSortOptions
  7. {
  8. public string Key { get; set; }
  9. public bool Descending { get; set; }
  10. public bool Lexographically { get; set; }
  11. public Int32 LowerLimit { get; set; }
  12. public Int32 UpperLimit { get; set; }
  13. public string By { get; set; }
  14. public string StoreInKey { get; set; }
  15. public string Get { get; set; }
  16. public object[] ToArgs()
  17. {
  18. System.Collections.ArrayList args = new System.Collections.ArrayList();
  19. if (LowerLimit != 0 || UpperLimit != 0)
  20. {
  21. args.Add("LIMIT");
  22. args.Add(LowerLimit);
  23. args.Add(UpperLimit);
  24. }
  25. if (Lexographically)
  26. args.Add("ALPHA");
  27. if (!string.IsNullOrEmpty(By))
  28. {
  29. args.Add("BY");
  30. args.Add(By);
  31. }
  32. if (!string.IsNullOrEmpty(Get))
  33. {
  34. args.Add("GET");
  35. args.Add(Get);
  36. }
  37. return args.ToArray();
  38. }
  39. }
  40. }