Skip to content

Add function to allow std::variant of supported redis types #138

Closed
@chill1n

Description

@chill1n

I have a specific problem with simply parsing the output of "memory stats" using the generic command("memory", "stats") call.
I've tried the obvious but it seems complicated with the current functionality.
Would it not be a generic extension to this library to add support for std::variant of supported redis types?
At this moment the current library supports STRING and INTEGER (not BOOL and DOUBLE yet), but that would suffice for most cases. An example output of "memory stats" is given below (which could be mapped to 25 pairs of either <string,long long> or <string,string>, or a single array of std::variant<string,long long>).
Any thoughts on how to approach parsing of "memory stats" with current functionality?
Any thoughts on the proposed support for std::variant?

  1. "peak.allocated"
  2. (integer) 18949144
  3. "total.allocated"
  4. (integer) 865720
  5. "startup.allocated"
  6. (integer) 802984
  7. "replication.backlog"
  8. (integer) 0
  9. "clients.slaves"
  10. (integer) 0
  11. "clients.normal"
  12. (integer) 16986
  13. "aof.buffer"
  14. (integer) 0
  15. "lua.caches"
  16. (integer) 0
  17. "overhead.total"
  18. (integer) 819970
  19. "keys.count"
  20. (integer) 0
  21. "keys.bytes-per-key"
  22. (integer) 0
  23. "dataset.bytes"
  24. (integer) 45750
  25. "dataset.percentage"
  26. "72.924636840820312"
  27. "peak.percentage"
  28. "4.5686497688293457"
  29. "allocator.allocated"
  30. (integer) 994000
  31. "allocator.active"
  32. (integer) 1363968
  33. "allocator.resident"
  34. (integer) 5042176
  35. "allocator-fragmentation.ratio"
  36. "1.3722012042999268"
  37. "allocator-fragmentation.bytes"
  38. (integer) 369968
  39. "allocator-rss.ratio"
  40. "3.6966967582702637"
  41. "allocator-rss.bytes"
  42. (integer) 3678208
  43. "rss-overhead.ratio"
  44. "0.63931763172149658"
  45. "rss-overhead.bytes"
  46. (integer) -1818624
  47. "fragmentation"
  48. "3.9087760448455811"
  49. "fragmentation.bytes"
  50. (integer) 2398856

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions