TS.GET key

Available in: Redis Stack

Time complexity: O(1)

TS.GET

Get the last sample.

TS.GET key
  • key - Key name for time series

Return Value

Array-reply, specifically:

The returned array will contain:

  • The last sample timestamp followed by the last sample value, when the time series contains data.
  • An empty array, when the time series is empty.

Complexity

TS.GET complexity is O(1).

Examples

Get Example on time series containing data
127.0.0.1:6379> TS.GET temperature:2:32
1) (integer) 1548149279
2) "23"
Get Example on empty time series
127.0.0.1:6379> redis-cli TS.GET empty_ts
(empty array)