TSREVRANGEBYTIME
This command fetches the values for the given low_ts
, high_ts
range in the time series that isspecified by the given key
ordered from newest to oldest. If LIMIT
is specified, then at mostlimit
pairs will be fetched.
- If the given
key
is associated with non-timeseries data, an error is raised. - If the given
low_ts
orhigh_ts
are not a valid signed 64 bit integers, an error is raised. - If
limit
is not a valid positive 32 bit integer, an error is raised. low_ts
andhigh_ts
are inclusive unless they are prefixed with(
, in that case they areexclusive.- Special bounds
-inf
and+inf
are also supported to retrieve an entire range
You can do this as shown below.
"OK"
1) "4"
2) "four"
3) "3"
5) "2"
6) "two"
TSREVRANGEBYTIME ts_key (2 4
2 and 4 are exclusive
TSREVRANGEBYTIME ts_key (2 (4
1) "3"
2) "three"
TSREVRANGEBYTIME ts_key -inf 3
1) "3"
2) "three"
3) "2"
4) "two"
5) "1"
6) "one"
1) "6"
4) "five"
5) "4"
6) "four"
7) "3"
8) "three"
9) "2"
10) "two"
TSREVRANGEBYTIME ts_key -inf 3 LIMIT 2
1) "3"
2) "three"
3) "2"
4) "two"
TSREVRANGEBYTIME ts_key -inf 3 LIMIT 10