It is unlikely to have a key with the maximum integer on the secondary id value:
1573474540414-18446744073709551615,
but if we want to use XREVRANGE, to make sure that we are iterating correct, the previous possible key for:
1573474540414-0 would be: 1573474540413-18446744073709551615
So, to correct use XREVRANGE:
127.0.0.1:6379> xrevrange cities + - COUNT 2
1) 1) "1573474557101-0"
2) 1) "locatin"
2) "victoria"
3) "user"
4) "2444"
5) "browser"
6) "opera"
7) "version"
8) "87"
2) 1) "1573474540414-0"
2) 1) "locatin"
2) "vancouver"
3) "user"
4) "1234"
5) "browser"
6) "firefox"
7) "version"
8) "20"
the next value to be used is:
127.0.0.1:6379> xrevrange cities 1573474540413-18446744073709551615 - COUNT 2
xrevrange cities 1573474540413-18446744073709551615 - COUNT 2
1) 1) "1573474521406-0"
2) 1) "locatin"
2) "calgary"
3) "user"
4) "8899"
5) "browser"
6) "edge"
7) "version"
8) "14"
2) 1) "1573474497649-0"
2) 1) "locatin"
2) "edmonton"
3) "user"
4) "1234"
5) "browser"
6) "chrome"
7) "version"
8) "99"
My suggesting os to create a pattern for the previous keys after or before a particular one:
[1573474540414-0 would be the previous one and 1573474540414-0] would be the next one.
making more simple to handle xrange and xrevrange.
My two cents:
@leomurillo Thanks for sharing this, It would be great if this feature is implemented. :)
Status:
Implementation effort looks low, we need to support both inclusive and exclusive boundaries on the xrange command.
Leo seems to have provided the consistent type of implementation. We will extend it to check if the first character is a (, which would indicate that this is an inclusive search.
Most helpful comment
Status:
Implementation effort looks low, we need to support both inclusive and exclusive boundaries on the xrange command.
Leo seems to have provided the consistent type of implementation. We will extend it to check if the first character is a (, which would indicate that this is an inclusive search.