TS.READ

Since 1.1.0Time series

Syntax

TS.READ key timestamp [BLOCK milliseconds min_count] [MAX_COUNT max_count]
  • Flags: blocking, readonly
  • ACL categories: @blocking, @read, @slow, @timeseries
  • Arity: -2

Returns the samples of the time series at key at or after timestamp, oldest first, for following a series as it grows (Redis 8.10). In place of a timestamp, - is the first sample, + the newest (included), and $ only samples added from now on.

BLOCK milliseconds min_count waits until min_count such samples exist, or the time passes. MAX_COUNT max_count returns at most that many.

Reply

  • An array of [timestamp, value] samples; empty if BLOCK timed out.

Examples

> TS.READ temp:2 +
1) 1) (integer) 25000
   2) "1"
> TS.READ temp:2 $ BLOCK 100 1
(empty array)